---
description: Quick introduction to using the core API and FFmpeg processes.
---

# Beginner

## Guide content

<figure><img src="https://951110271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQRvnKSkK1SsZB0HeYhh%2Fuploads%2FMLLlo8wyRezkW1mbjbbi%2Fcore-guide-beginner.png?alt=media&#x26;token=dcbb27bc-bfeb-4028-8741-302a6f70dafe" alt=""><figcaption><p>Finally, two FFmpeg processes are running, using the RTMP server and the in-memory filesystem.</p></figcaption></figure>

1. Starting the Core container
2. Configure and restart the Core
3. Creating, verifying, updating, and deleting an FFmpeg process&#x20;
4. Using placeholders for the in-memory file system and RTMP server
5. Analyze FFmpeg process errors



## 1. Start the Core

```
docker run --detach --name core --publish 8080:8080 datarhei/core:latest
```

<figure><img src="https://951110271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQRvnKSkK1SsZB0HeYhh%2Fuploads%2FCijVLHwZ9GQhI71n8db5%2Fguide-b1.gif?alt=media&#x26;token=dba8b335-1873-4c0b-99a7-0815310e031d" alt=""><figcaption></figcaption></figure>

##

## 2. Enable the RTMP server on the Core

1. Configuring the Core via the API
2. Restarting the Core via the API and loading the changed configuration
3. Calling the RTMP API



### 2.1 Changing the Configuration

{% tabs %}
{% tab title="Request" %}
```bash
curl http://127.0.0.1:8080/api/v3/config \
   -H 'accept: application/json' \
   -H 'Content-Type: application/json' \
   -X PUT \
   -d '{
         "version": 3,
         "rtmp": {
            "enable": true
         }
      }'
```
{% endtab %}

{% tab title="Response" %}
```
"OK"
```
{% endtab %}
{% endtabs %}

#### API Documentation > Configuration

{% content-ref url="../api/config" %}
[config](../api/config)
{% endcontent-ref %}



### 2.2 Apply the change

{% tabs %}
{% tab title="Request" %}
```bash
curl http://127.0.0.1:8080/api/v3/config/reload \
    -X GET
```
{% endtab %}

{% tab title="Response" %}
```
"OK"
```
{% endtab %}
{% endtabs %}



### 2.3 Checking the RTMP server

{% tabs %}
{% tab title="Request" %}
```bash
curl http://127.0.0.1:8080/api/v3/rtmp \
    -X GET
```
{% endtab %}

{% tab title="Response" %}
```
[]
```
{% endtab %}
{% endtabs %}



##

## 3. Main-process

<figure><img src="https://951110271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQRvnKSkK1SsZB0HeYhh%2Fuploads%2Fo3wmIJ2AHCeTXIga2g0n%2Fcore-guide-beginner-main.png?alt=media&#x26;token=5cad9279-80f6-4438-9d5a-87482ba696a3" alt=""><figcaption><p>Fig. 1: Create the main-process</p></figcaption></figure>

1. Initiating the main-process using the Process API
2. Check the main-process via the Process API
3. Update the main-process via the Process API
4. Check the change of the main-process via the Process API
5. Monitor the RTMP stream via the RTMP API



### 3.1 Create the FFmpeg process

{% tabs %}
{% tab title="Request" %}
```bash
curl http://127.0.0.1:8080/api/v3/process \
   -H 'accept: application/json' \
   -H 'Content-Type: application/json' \
   -X POST \
   -d '{
         "id": "main",
         "options": [],
         "input": [
            {
               "address": "testsrc=size=1280x720:rate=25",
               "id": "0",
               "options": ["-f", "lavfi", "-re"]
            }
         ],
         "output": [
            {
               "address": "-",
               "id": "0",
               "options": ["-c:v", "libx264", "-f", "null"]
            }
         ],
         "autostart": true,
         "reconnect": true,
         "reconnect_delay_seconds": 10,
         "stale_timeout_seconds": 10
      }'
```

The configuration creates a process with a virtual video input with no output.
{% endtab %}

{% tab title="Response" %}
{% code overflow="wrap" %}
```json
{
    "id": "main",
    "type": "ffmpeg",
    "reference": "",
    "input": [{
        "id": "0",
        "address": "testsrc=size=1280x720:rate=25",
        "options": ["-f", "lavfi", "-re"]
    }],
    "output": [{
        "id": "0",
        "address": "-",
        "options": ["-c:v", "libx264", "-f", "null"]
    }],
    "options": [],
    "reconnect": true,
    "reconnect_delay_seconds": 10,
    "autostart": true,
    "stale_timeout_seconds": 10,
    "limits": {
        "cpu_usage": 0,
        "memory_mbytes": 0,
        "waitfor_seconds": 0
    }
}
```
{% endcode %}
{% endtab %}
{% endtabs %}

#### API Documentation > FFmpeg processing

{% content-ref url="../api-ffmpeg/process" %}
[process](../api-ffmpeg/process)
{% endcontent-ref %}



### 3.2 Check that the FFmpeg process is running

{% tabs %}
{% tab title="Request" %}
```bash
curl http://127.0.0.1:8080/api/v3/process/main/state \
   -H 'accept: application/json' \
   -H 'Content-Type: application/json' \
   -X GET
```
{% endtab %}

{% tab title="Response" %}
```json
{
    "order": "start",
    "exec": "running",
    "runtime_seconds": 36,
    "reconnect_seconds": -1,
    "last_logline": "ffmpeg.mapping:{\"graphs\":[{\"index\":0,\"graph\":[{\"src_name\":\"Parsed_null_0\",\"src_filter\":\"null\",\"dst_name\":\"auto_scale_0\",\"dst_filter\":\"scale\",\"inpad\":\"default\",\"outpad\":\"default\",\"timebase\": \"1/25\",\"type\":\"video\",\"format\":\"rgb24\",\"width\":1280,\"height\":720},{\"src_name\":\"graph 0 input from stream 0:0\",\"src_filter\":\"buffer\",\"dst_name\":\"Parsed_null_0\",\"dst_filter\":\"null\",\"inpad\":\"default\",\"outpad\":\"default\",\"timebase\": \"1/25\",\"type\":\"video\",\"format\":\"rgb24\",\"width\":1280,\"height\":720},{\"src_name\":\"format\",\"src_filter\":\"format\",\"dst_name\":\"out_0_0\",\"dst_filter\":\"buffersink\",\"inpad\":\"default\",\"outpad\":\"default\",\"timebase\": \"1/25\",\"type\":\"video\",\"format\":\"yuv444p\",\"width\":1280,\"height\":720},{\"src_name\":\"auto_scale_0\",\"src_filter\":\"scale\",\"dst_name\":\"format\",\"dst_filter\":\"format\",\"inpad\":\"default\",\"outpad\":\"default\",\"timebase\": \"1/25\",\"type\":\"video\",\"format\":\"yuv444p\",\"width\":1280,\"height\":720}]}],\"mapping\":[{\"input\":{\"index\":0,\"stream\":0},\"graph\":{\"index\":0,\"name\":\"graph 0 input from stream 0:0\"},\"output\":null},{\"input\":null,\"graph\":{\"index\":0,\"name\":\"out_0_0\"},\"output\":{\"index\":0,\"stream\":0}}]}",
    "progress": {
        "inputs": [{
            "id": "0",
            "address": "testsrc=size=1280x720:rate=25",
            "index": 0,
            "stream": 0,
            "format": "lavfi",
            "type": "video",
            "codec": "rawvideo",
            "coder": "rawvideo",
            "frame": 910,
            "fps": 25.267,
            "packet": 910,
            "pps": 25.267,
            "size_kb": 2457000,
            "bitrate_kbit": 545760.000,
            "pix_fmt": "rgb24",
            "q": 0.000,
            "width": 1280,
            "height": 720,
            "avstream": null
        }],
        "outputs": [{
            "id": "0",
            "address": "pipe:",
            "index": 0,
            "stream": 0,
            "format": "null",
            "type": "video",
            "codec": "h264",
            "coder": "libx264",
            "frame": 910,
            "fps": 25.267,
            "packet": 860,
            "pps": 25.267,
            "size_kb": 332,
            "bitrate_kbit": 76.800,
            "pix_fmt": "yuv444p",
            "q": 28.000,
            "width": 1280,
            "height": 720,
            "avstream": null
        }],
        "frame": 910,
        "packet": 860,
        "fps": 25.267,
        "q": 28,
        "size_kb": 332,
        "time": 34.320,
        "bitrate_kbit": 76.800,
        "speed": 0.943,
        "drop": 0,
        "dup": 0
    },
    "memory_bytes": 427692032,
    "cpu_usage": 22.015,
    "command": ["-f", "lavfi", "-re", "-i", "testsrc=size=1280x720:rate=25", "-c:v", "libx264", "-f", "null", "-"]
}
```
{% endtab %}
{% endtabs %}

{% hint style="success" %}
The process is running if the **exec** state in the response is **running** and the **progress.packet** is **increasing**.
{% endhint %}



### 3.3 Update the FFmpeg process

{% tabs %}
{% tab title="Request" %}
```bash
curl http://127.0.0.1:8080/api/v3/process/main \
   -H 'accept: application/json' \
   -H 'Content-Type: application/json' \
   -X PUT \
   -d '{
         "id": "main",
         "options": [],
         "input": [
            {
               "address": "testsrc=size=1280x720:rate=25",
               "id": "0",
               "options": ["-f", "lavfi", "-re"]
            }
         ],
         "output": [
            {
               "address": "{rtmp,name=main}",
               "id": "0",
               "options": ["-c:v", "libx264", "-f", "flv"]
            }
         ],
         "autostart": true,
         "reconnect": true,
         "reconnect_delay_seconds": 10,
         "stale_timeout_seconds": 10
      }'
```

This configuration creates an RTMP stream as output and sends it to the internal RTMP server. It uses the {rtmp} placeholder for ease of integration.
{% endtab %}

{% tab title="Response" %}
```json
{
    "id": "main",
    "type": "ffmpeg",
    "reference": "",
    "input": [{
        "id": "0",
        "address": "testsrc=size=1280x720:rate=25",
        "options": ["-f", "lavfi", "-re"]
    }],
    "output": [{
        "id": "0",
        "address": "{rtmp,name=main}",
        "options": ["-c:v", "libx264", "-f", "flv"]
    }],
    "options": [],
    "reconnect": true,
    "reconnect_delay_seconds": 10,
    "autostart": true,
    "stale_timeout_seconds": 10,
    "limits": {
        "cpu_usage": 0,
        "memory_mbytes": 0,
        "waitfor_seconds": 0
    }
}
```
{% endtab %}
{% endtabs %}



### 3.4 Check that the FFmpeg process is running again

{% tabs %}
{% tab title="Request" %}
```bash
curl http://127.0.0.1:8080/api/v3/process/main/state \
   -H 'accept: application/json' \
   -H 'Content-Type: application/json' \
   -X GET
```
{% endtab %}

{% tab title="Response" %}
```json
{
    "order": "start",
    "exec": "running",
    "runtime_seconds": 32,
    "reconnect_seconds": -1,
    "last_logline": "ffmpeg.mapping:{\"graphs\":[{\"index\":0,\"graph\":[{\"src_name\":\"Parsed_null_0\",\"src_filter\":\"null\",\"dst_name\":\"auto_scale_0\",\"dst_filter\":\"scale\",\"inpad\":\"default\",\"outpad\":\"default\",\"timebase\": \"1/25\",\"type\":\"video\",\"format\":\"rgb24\",\"width\":1280,\"height\":720},{\"src_name\":\"graph 0 input from stream 0:0\",\"src_filter\":\"buffer\",\"dst_name\":\"Parsed_null_0\",\"dst_filter\":\"null\",\"inpad\":\"default\",\"outpad\":\"default\",\"timebase\": \"1/25\",\"type\":\"video\",\"format\":\"rgb24\",\"width\":1280,\"height\":720},{\"src_name\":\"format\",\"src_filter\":\"format\",\"dst_name\":\"out_0_0\",\"dst_filter\":\"buffersink\",\"inpad\":\"default\",\"outpad\":\"default\",\"timebase\": \"1/25\",\"type\":\"video\",\"format\":\"yuv444p\",\"width\":1280,\"height\":720},{\"src_name\":\"auto_scale_0\",\"src_filter\":\"scale\",\"dst_name\":\"format\",\"dst_filter\":\"format\",\"inpad\":\"default\",\"outpad\":\"default\",\"timebase\": \"1/25\",\"type\":\"video\",\"format\":\"yuv444p\",\"width\":1280,\"height\":720}]}],\"mapping\":[{\"input\":{\"index\":0,\"stream\":0},\"graph\":{\"index\":0,\"name\":\"graph 0 input from stream 0:0\"},\"output\":null},{\"input\":null,\"graph\":{\"index\":0,\"name\":\"out_0_0\"},\"output\":{\"index\":0,\"stream\":0}}]}",
    "progress": {
        "inputs": [{
            "id": "0",
            "address": "testsrc=size=1280x720:rate=25",
            "index": 0,
            "stream": 0,
            "format": "lavfi",
            "type": "video",
            "codec": "rawvideo",
            "coder": "rawvideo",
            "frame": 796,
            "fps": 24.833,
            "packet": 796,
            "pps": 24.833,
            "size_kb": 2149200,
            "bitrate_kbit": 536400.000,
            "pix_fmt": "rgb24",
            "q": 0.000,
            "width": 1280,
            "height": 720,
            "avstream": null
        }],
        "outputs": [{
            "id": "0",
            "address": "rtmp://localhost:1935/main",
            "index": 0,
            "stream": 0,
            "format": "flv",
            "type": "video",
            "codec": "h264",
            "coder": "libx264",
            "frame": 796,
            "fps": 24.833,
            "packet": 746,
            "pps": 24.833,
            "size_kb": 284,
            "bitrate_kbit": 73.600,
            "pix_fmt": "yuv444p",
            "q": 25.000,
            "width": 1280,
            "height": 720,
            "avstream": null
        }],
        "frame": 796,
        "packet": 746,
        "fps": 24.833,
        "q": 25,
        "size_kb": 284,
        "time": 29.720,
        "bitrate_kbit": 73.600,
        "speed": 0.934,
        "drop": 0,
        "dup": 0
    },
    "memory_bytes": 428478464,
    "cpu_usage": 18.249,
    "command": ["-f", "lavfi", "-re", "-i", "testsrc=size=1280x720:rate=25", "-c:v", "libx264", "-f", "flv", "rtmp://localhost:1935/main"]
}
```
{% endtab %}
{% endtabs %}



### 3.5 Check that the RTMP stream is available

{% tabs %}
{% tab title="Request" %}
```bash
curl http://127.0.0.1:8080/api/v3/rtmp \
    -X GET
```
{% endtab %}

{% tab title="Response" %}
```json
[{
    "name": "/main"
}]
```
{% endtab %}
{% endtabs %}

{% hint style="success" %}
Now you can pull the stream from the RTMP server with the URL `rtmp://127.0.0.1:1935/main`.
{% endhint %}

#### API Documentation > RTMP

{% content-ref url="../api-rtmp/rtmp" %}
[rtmp](../api-rtmp/rtmp)
{% endcontent-ref %}

##

## 4. Sub-process

<figure><img src="https://951110271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQRvnKSkK1SsZB0HeYhh%2Fuploads%2FMLLlo8wyRezkW1mbjbbi%2Fcore-guide-beginner.png?alt=media&#x26;token=dcbb27bc-bfeb-4028-8741-302a6f70dafe" alt=""><figcaption><p>Fig. 2: Create the sub-process</p></figcaption></figure>

1. Initiate the sub-process through the Process API
2. Check the sub-process through the Process API
3. Monitor the HLS stream via the file system API



### 4.1 Create the FFmpeg process

{% tabs %}
{% tab title="Request" %}
```bash
curl http://127.0.0.1:8080/api/v3/process \
   -H 'accept: application/json' \
   -H 'Content-Type: application/json' \
   -X POST \
   -d '{
         "id": "sub",
         "options": [],
         "input": [
            {
               "address": "{rtmp,name=main}",
               "id": "0",
               "options": []
            }
         ],
         "output": [
            {
               "address": "{memfs}/{processid}.m3u8",
               "id": "0",
               "options": ["-f", "hls"]
            }
         ],
         "autostart": true,
         "reconnect": true,
         "reconnect_delay_seconds": 10,
         "stale_timeout_seconds": 10
      }'
```

This configuration uses the RTMP stream from the main-process and creates an HLS stream as an output on the internal in-memory file system. It uses the {memfs} placeholder for ease of integration.
{% endtab %}

{% tab title="Response" %}
```json
{
    "id": "sub",
    "type": "ffmpeg",
    "reference": "",
    "input": [{
        "id": "0",
        "address": "{rtmp,name=main}",
        "options": []
    }],
    "output": [{
        "id": "0",
        "address": "{memfs}/{processid}.m3u8",
        "options": ["-f", "hls"]
    }],
    "options": [],
    "reconnect": true,
    "reconnect_delay_seconds": 10,
    "autostart": true,
    "stale_timeout_seconds": 10,
    "limits": {
        "cpu_usage": 0,
        "memory_mbytes": 0,
        "waitfor_seconds": 0
    }
}
```
{% endtab %}
{% endtabs %}



### 4.2 Check that the FFmpeg process is running

{% tabs %}
{% tab title="Request" %}
```bash
curl http://127.0.0.1:8080/api/v3/process/sub/state \
   -H 'accept: application/json' \
   -H 'Content-Type: application/json' \
   -X GET
```
{% endtab %}

{% tab title="Response" %}
```json
{
    "order": "start",
    "exec": "running",
    "runtime_seconds": 31,
    "reconnect_seconds": -1,
    "last_logline": "[hls @ 0x7fbf1e8fd340] Opening 'http://admin:irIVvk4miq3JhKGZnY@localhost:8080/memfs/sub_22.ts' for writing",
    "progress": {
        "inputs": [{
            "id": "0",
            "address": "rtmp://localhost:1935/main",
            "index": 0,
            "stream": 0,
            "format": "flv",
            "type": "video",
            "codec": "h264",
            "coder": "h264",
            "frame": 828,
            "fps": 29.704,
            "packet": 834,
            "pps": 29.926,
            "size_kb": 322,
            "bitrate_kbit": 93.037,
            "pix_fmt": "yuv444p",
            "q": 0.000,
            "width": 1280,
            "height": 720,
            "avstream": null
        }],
        "outputs": [{
            "id": "0",
            "address": "http://admin:irIVvk4miq3JhKGZnY@localhost:8080/memfs/sub.m3u8",
            "index": 0,
            "stream": 0,
            "format": "hls",
            "type": "video",
            "codec": "h264",
            "coder": "libx264",
            "frame": 828,
            "fps": 29.704,
            "packet": 778,
            "pps": 27.852,
            "size_kb": 322,
            "bitrate_kbit": 92.741,
            "pix_fmt": "yuv444p",
            "q": 28.000,
            "width": 1280,
            "height": 720,
            "avstream": null
        }],
        "frame": 828,
        "packet": 778,
        "fps": 29.704,
        "q": 28,
        "size_kb": 322,
        "time": 31.400,
        "bitrate_kbit": 92.741,
        "speed": 1.100,
        "drop": 0,
        "dup": 0
    },
    "memory_bytes": 467107840,
    "cpu_usage": 18.008,
    "command": ["-i", "rtmp://localhost:1935/main", "-f", "hls", "http://admin:irIVvk4miq3JhKGZnY@localhost:8080/memfs/sub.m3u8"]
}
```
{% endtab %}
{% endtabs %}



### 4.3 Check that the HLS stream is available

{% tabs %}
{% tab title="Request" %}
```bash
curl http://127.0.0.1:8080/api/v3/fs/mem \
   -H 'accept: application/json' \
   -H 'Content-Type: application/json' \
   -X GET
```
{% endtab %}

{% tab title="Response" %}
```json
[{
    "name": "/sub0.ts",
    "size_bytes": 143444,
    "last_modified": 1674208099
}, {
    "name": "/sub1.ts",
    "size_bytes": 139684,
    "last_modified": 1674208109
}, {
    "name": "/sub2.ts",
    "size_bytes": 144008,
    "last_modified": 1674208119
}, {
    "name": "/sub3.ts",
    "size_bytes": 143068,
    "last_modified": 1674208129
}, {
    "name": "/sub4.ts",
    "size_bytes": 141376,
    "last_modified": 1674208139
}, {
    "name": "/sub5.ts",
    "size_bytes": 142504,
    "last_modified": 1674208149
}, {
    "name": "/sub6.ts",
    "size_bytes": 143068,
    "last_modified": 1674208159
}, {
    "name": "/sub7.ts",
    "size_bytes": 141376,
    "last_modified": 1674208169
}, {
    "name": "/sub8.ts",
    "size_bytes": 142504,
    "last_modified": 1674208179
}, {
    "name": "/sub9.ts",
    "size_bytes": 143256,
    "last_modified": 1674208189
}, {
    "name": "/sub.m3u8",
    "size_bytes": 209,
    "last_modified": 1674208189
}]json
```
{% endtab %}
{% endtabs %}

{% hint style="success" %}
Now you can pull the stream from the in-memory filesystem with the URL `http://127.0.0.1:8080/memfs/sub.m3u8`.
{% endhint %}

#### API Documentation > Filesystem > In-Memory

{% content-ref url="../api/filesystem/in-memory" %}
[in-memory](../api/filesystem/in-memory)
{% endcontent-ref %}

##

## 5. Analyze process failers

1. Stop the main-process through the Process API
2. Check the sub-process via process API
3. Analyze the sub-process log report via the Process API
4. Start the main-process through the Process API
5. Check the sub-process through the Process API



### 5.1 Create an error on the video input of the sub-process

{% tabs %}
{% tab title="Request" %}
```bash
curl http://127.0.0.1:8080/api/v3/process/main/command \
   -H 'accept: application/json' \
   -H 'Content-Type: application/json' \
   -X PUT \
   -d '{"command": "stop"}'
```

This command stops the running main-process and interrupts the RTMP stream.
{% endtab %}

{% tab title="Response" %}
```
"OK"
```
{% endtab %}
{% endtabs %}



### 5.2 Check the status of the sub-process

{% tabs %}
{% tab title="Request" %}
```bash
curl http://127.0.0.1:8080/api/v3/process/sub/state \
   -H 'accept: application/json' \
   -H 'Content-Type: application/json' \
   -X GET
```
{% endtab %}

{% tab title="Response" %}
```json
{
    "order": "start",
    "exec": "failed",
    "runtime_seconds": 6,
    "reconnect_seconds": 3,
    "last_logline": "rtmp://localhost:1935/main: Broken pipe",
    "progress": {
        "inputs": [],
        "outputs": [],
        "frame": 0,
        "packet": 0,
        "fps": 0,
        "q": 0,
        "size_kb": 0,
        "time": 0,
        "bitrate_kbit": 0,
        "speed": 0,
        "drop": 0,
        "dup": 0
    },
    "memory_bytes": 0,
    "cpu_usage": 0,
    "command": ["-i", "rtmp://localhost:1935/main", "-f", "hls", "http://admin:irIVvk4miq3JhKGZnY@localhost:8080/memfs/sub.m3u8"]
}
```
{% endtab %}
{% endtabs %}

{% hint style="danger" %}
If a process has the **order=start**, does not return **exec=running**, and **progress.packet** is not ascending or >0, it indicates an error.
{% endhint %}



### 5.3 Analyze the sub-process report

{% tabs %}
{% tab title="Request" %}
```bash
curl http://127.0.0.1:8080/api/v3/process/sub/report \
   -H 'accept: application/json' \
   -H 'Content-Type: application/json' \
   -X GE
```
{% endtab %}

{% tab title="Response" %}
```json
{
    "created_at": 1674134954,
    "prelude": ["ffmpeg version 5.1.2-datarhei Copyright (c) 2000-2022 the FFmpeg developers", "  built with gcc 11.2.1 (Alpine 11.2.1_git20220219) 20220219", "  configuration: --extra-version=datarhei --prefix=/usr --extra-libs='-lpthread -lxml2 -lm -lz -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl' --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-libv4l2 --enable-v4l2_m2m --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-debug --disable-doc --disable-shared", "  libavutil      57. 28.100 / 57. 28.100", "  libavcodec     59. 37.100 / 59. 37.100", "  libavformat    59. 27.100 / 59. 27.100", "  libavdevice    59.  7.100 / 59.  7.100", "  libavfilter     8. 44.100 /  8. 44.100", "  libswscale      6.  7.100 /  6.  7.100", "  libswresample   4.  7.100 /  4.  7.100", "  libpostproc    56.  6.100 / 56.  6.100", "rtmp://localhost:1935/main: Broken pipe"],
    "log": [
        ["1674134954", "ffmpeg version 5.1.2-datarhei Copyright (c) 2000-2022 the FFmpeg developers"],
        ["1674134954", "  built with gcc 11.2.1 (Alpine 11.2.1_git20220219) 20220219"],
        ["1674134954", "  configuration: --extra-version=datarhei --prefix=/usr --extra-libs='-lpthread -lxml2 -lm -lz -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl' --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-libv4l2 --enable-v4l2_m2m --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-debug --disable-doc --disable-shared"],
        ["1674134954", "  libavutil      57. 28.100 / 57. 28.100"],
        ["1674134954", "  libavcodec     59. 37.100 / 59. 37.100"],
        ["1674134954", "  libavformat    59. 27.100 / 59. 27.100"],
        ["1674134954", "  libavdevice    59.  7.100 / 59.  7.100"],
        ["1674134954", "  libavfilter     8. 44.100 /  8. 44.100"],
        ["1674134954", "  libswscale      6.  7.100 /  6.  7.100"],
        ["1674134954", "  libswresample   4.  7.100 /  4.  7.100"],
        ["1674134954", "  libpostproc    56.  6.100 / 56.  6.100"],
        ["1674134954", "rtmp://localhost:1935/main: Broken pipe"]
    ],
    "history": [{
        "created_at": 1674134924,
        "prelude": ["ffmpeg version 5.1.2-datarhei Copyright (c) 2000-2022 the FFmpeg developers", "  built with gcc 11.2.1 (Alpine 11.2.1_git20220219) 20220219", "  configuration: --extra-version=datarhei --prefix=/usr --extra-libs='-lpthread -lxml2 -lm -lz -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl' --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-libv4l2 --enable-v4l2_m2m --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-debug --disable-doc --disable-shared", "  libavutil      57. 28.100 / 57. 28.100", "  libavcodec     59. 37.100 / 59. 37.100", "  libavformat    59. 27.100 / 59. 27.100", "  libavdevice    59.  7.100 / 59.  7.100", "  libavfilter     8. 44.100 /  8. 44.100", "  libswscale      6.  7.100 /  6.  7.100", "  libswresample   4.  7.100 /  4.  7.100", "  libpostproc    56.  6.100 / 56.  6.100", "rtmp://localhost:1935/main: I/O error"],
        "log": [
            ["1674134924", "ffmpeg version 5.1.2-datarhei Copyright (c) 2000-2022 the FFmpeg developers"],
            ["1674134924", "  built with gcc 11.2.1 (Alpine 11.2.1_git20220219) 20220219"],
            ["1674134924", "  configuration: --extra-version=datarhei --prefix=/usr --extra-libs='-lpthread -lxml2 -lm -lz -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl' --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-libv4l2 --enable-v4l2_m2m --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-debug --disable-doc --disable-shared"],
            ["1674134924", "  libavutil      57. 28.100 / 57. 28.100"],
            ["1674134924", "  libavcodec     59. 37.100 / 59. 37.100"],
            ["1674134924", "  libavformat    59. 27.100 / 59. 27.100"],
            ["1674134924", "  libavdevice    59.  7.100 / 59.  7.100"],
            ["1674134924", "  libavfilter     8. 44.100 /  8. 44.100"],
            ["1674134924", "  libswscale      6.  7.100 /  6.  7.100"],
            ["1674134924", "  libswresample   4.  7.100 /  4.  7.100"],
            ["1674134924", "  libpostproc    56.  6.100 / 56.  6.100"],
            ["1674134924", "rtmp://localhost:1935/main: I/O error"]
        ]
    }, {
        "created_at": 1674134934,
        "prelude": ["ffmpeg version 5.1.2-datarhei Copyright (c) 2000-2022 the FFmpeg developers", "  built with gcc 11.2.1 (Alpine 11.2.1_git20220219) 20220219", "  configuration: --extra-version=datarhei --prefix=/usr --extra-libs='-lpthread -lxml2 -lm -lz -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl' --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-libv4l2 --enable-v4l2_m2m --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-debug --disable-doc --disable-shared", "  libavutil      57. 28.100 / 57. 28.100", "  libavcodec     59. 37.100 / 59. 37.100", "  libavformat    59. 27.100 / 59. 27.100", "  libavdevice    59.  7.100 / 59.  7.100", "  libavfilter     8. 44.100 /  8. 44.100", "  libswscale      6.  7.100 /  6.  7.100", "  libswresample   4.  7.100 /  4.  7.100", "  libpostproc    56.  6.100 / 56.  6.100", "rtmp://localhost:1935/main: Broken pipe"],
        "log": [
            ["1674134934", "ffmpeg version 5.1.2-datarhei Copyright (c) 2000-2022 the FFmpeg developers"],
            ["1674134934", "  built with gcc 11.2.1 (Alpine 11.2.1_git20220219) 20220219"],
            ["1674134934", "  configuration: --extra-version=datarhei --prefix=/usr --extra-libs='-lpthread -lxml2 -lm -lz -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl' --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-libv4l2 --enable-v4l2_m2m --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-debug --disable-doc --disable-shared"],
            ["1674134934", "  libavutil      57. 28.100 / 57. 28.100"],
            ["1674134934", "  libavcodec     59. 37.100 / 59. 37.100"],
            ["1674134934", "  libavformat    59. 27.100 / 59. 27.100"],
            ["1674134934", "  libavdevice    59.  7.100 / 59.  7.100"],
            ["1674134934", "  libavfilter     8. 44.100 /  8. 44.100"],
            ["1674134934", "  libswscale      6.  7.100 /  6.  7.100"],
            ["1674134934", "  libswresample   4.  7.100 /  4.  7.100"],
            ["1674134934", "  libpostproc    56.  6.100 / 56.  6.100"],
            ["1674134934", "rtmp://localhost:1935/main: Broken pipe"]
        ]
    }, {
        "created_at": 1674134944,
        "prelude": ["ffmpeg version 5.1.2-datarhei Copyright (c) 2000-2022 the FFmpeg developers", "  built with gcc 11.2.1 (Alpine 11.2.1_git20220219) 20220219", "  configuration: --extra-version=datarhei --prefix=/usr --extra-libs='-lpthread -lxml2 -lm -lz -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl' --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-libv4l2 --enable-v4l2_m2m --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-debug --disable-doc --disable-shared", "  libavutil      57. 28.100 / 57. 28.100", "  libavcodec     59. 37.100 / 59. 37.100", "  libavformat    59. 27.100 / 59. 27.100", "  libavdevice    59.  7.100 / 59.  7.100", "  libavfilter     8. 44.100 /  8. 44.100", "  libswscale      6.  7.100 /  6.  7.100", "  libswresample   4.  7.100 /  4.  7.100", "  libpostproc    56.  6.100 / 56.  6.100", "rtmp://localhost:1935/main: I/O error"],
        "log": [
            ["1674134944", "ffmpeg version 5.1.2-datarhei Copyright (c) 2000-2022 the FFmpeg developers"],
            ["1674134944", "  built with gcc 11.2.1 (Alpine 11.2.1_git20220219) 20220219"],
            ["1674134944", "  configuration: --extra-version=datarhei --prefix=/usr --extra-libs='-lpthread -lxml2 -lm -lz -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl' --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-libv4l2 --enable-v4l2_m2m --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-debug --disable-doc --disable-shared"],
            ["1674134944", "  libavutil      57. 28.100 / 57. 28.100"],
            ["1674134944", "  libavcodec     59. 37.100 / 59. 37.100"],
            ["1674134944", "  libavformat    59. 27.100 / 59. 27.100"],
            ["1674134944", "  libavdevice    59.  7.100 / 59.  7.100"],
            ["1674134944", "  libavfilter     8. 44.100 /  8. 44.100"],
            ["1674134944", "  libswscale      6.  7.100 /  6.  7.100"],
            ["1674134944", "  libswresample   4.  7.100 /  4.  7.100"],
            ["1674134944", "  libpostproc    56.  6.100 / 56.  6.100"],
            ["1674134944", "rtmp://localhost:1935/main: I/O error"]
        ]
    }]
}
```

The current and the last three process logs are available in the report.
{% endtab %}
{% endtabs %}

{% hint style="danger" %}
The log entries in the response

* **rtmp://localhost:1935/main: Broken pipe**
* **rtmp://localhost:1935/main I/O error**

indicate that the video source is unreachable, so the process fails.
{% endhint %}



### 5.4 Fix the process failer

{% tabs %}
{% tab title="Request" %}
```bash
curl http://127.0.0.1:8080/api/v3/process/main/command \
   -H 'accept: application/json' \
   -H 'Content-Type: application/json' \
   -X PUT \
   -d '{"command":"start"}'
```

This command enables the main-process again.
{% endtab %}

{% tab title="Response" %}
```
"OK"
```
{% endtab %}
{% endtabs %}



### 5.5 Verify the fix

{% tabs %}
{% tab title="Request" %}
```bash
curl http://127.0.0.1:8080/api/v3/process/sub/state \
   -H 'accept: application/json' \
   -H 'Content-Type: application/json' \
   -X GET
```
{% endtab %}

{% tab title="Response" %}
```json
{
    "order": "start",
    "exec": "running",
    "runtime_seconds": 1,
    "reconnect_seconds": -1,
    "last_logline": "ffmpeg.mapping:{\"graphs\":[{\"index\":0,\"graph\":[{\"src_name\":\"Parsed_null_0\",\"src_filter\":\"null\",\"dst_name\":\"format\",\"dst_filter\":\"format\",\"inpad\":\"default\",\"outpad\":\"default\",\"timebase\": \"1/1000\",\"type\":\"video\",\"format\":\"yuv444p\",\"width\":1280,\"height\":720},{\"src_name\":\"graph 0 input from stream 0:0\",\"src_filter\":\"buffer\",\"dst_name\":\"Parsed_null_0\",\"dst_filter\":\"null\",\"inpad\":\"default\",\"outpad\":\"default\",\"timebase\": \"1/1000\",\"type\":\"video\",\"format\":\"yuv444p\",\"width\":1280,\"height\":720},{\"src_name\":\"format\",\"src_filter\":\"format\",\"dst_name\":\"out_0_0\",\"dst_filter\":\"buffersink\",\"inpad\":\"default\",\"outpad\":\"default\",\"timebase\": \"1/1000\",\"type\":\"video\",\"format\":\"yuv444p\",\"width\":1280,\"height\":720}]}],\"mapping\":[{\"input\":{\"index\":0,\"stream\":0},\"graph\":{\"index\":0,\"name\":\"graph 0 input from stream 0:0\"},\"output\":null},{\"input\":null,\"graph\":{\"index\":0,\"name\":\"out_0_0\"},\"output\":{\"index\":0,\"stream\":0}}]}",
    "progress": {
        "inputs": [{
            "id": "0",
            "address": "rtmp://localhost:1935/main",
            "index": 0,
            "stream": 0,
            "format": "flv",
            "type": "video",
            "codec": "h264",
            "coder": "h264",
            "frame": 116,
            "fps": 0.000,
            "packet": 122,
            "pps": 0.000,
            "size_kb": 51,
            "bitrate_kbit": 0.000,
            "pix_fmt": "yuv444p",
            "q": 0.000,
            "width": 1280,
            "height": 720,
            "avstream": null
        }],
        "outputs": [{
            "id": "0",
            "address": "http://admin:irIVvk4miq3JhKGZnY@localhost:8080/memfs/sub.m3u8",
            "index": 0,
            "stream": 0,
            "format": "hls",
            "type": "video",
            "codec": "h264",
            "coder": "libx264",
            "frame": 116,
            "fps": 0.000,
            "packet": 66,
            "pps": 0.000,
            "size_kb": 34,
            "bitrate_kbit": 0.000,
            "pix_fmt": "yuv444p",
            "q": 28.000,
            "width": 1280,
            "height": 720,
            "avstream": null
        }],
        "frame": 116,
        "packet": 66,
        "fps": 0,
        "q": 28,
        "size_kb": 34,
        "time": 2.560,
        "bitrate_kbit": 0,
        "speed": 2.520,
        "drop": 0,
        "dup": 0
    },
    "memory_bytes": 463351808,
    "cpu_usage": 0,
    "command": ["-i", "rtmp://localhost:1935/main", "-f", "hls", "http://admin:irIVvk4miq3JhKGZnY@localhost:8080/memfs/sub.m3u8"]
}
```
{% endtab %}
{% endtabs %}

{% hint style="success" %}
The **exec** status in the response is **running** again.
{% endhint %}

##

## 6. Cleanup

1. Stops and deletes the sub-process via the Process API
2. Stops and deletes the main-process via the Process API



### 6.1 Delete the sub-process

{% tabs %}
{% tab title="Request" %}
```bash
curl http://127.0.0.1:8080/api/v3/process/sub \
   -H 'accept: application/json' \
   -H 'Content-Type: application/json' \
   -X DELETE
```
{% endtab %}

{% tab title="Response" %}
```
"OK"
```


{% endtab %}
{% endtabs %}



### 6.2 Delete the main-process

{% tabs %}
{% tab title="Request" %}
```bash
curl http://127.0.0.1:8080/api/v3/process/main \
   -H 'accept: application/json' \
   -H 'Content-Type: application/json' \
   -X DELETE
```
{% endtab %}

{% tab title="Response" %}
```
"OK"
```
{% endtab %}
{% endtabs %}



### 6.3 Stop the Core

```
docker kill core
```

```
docker rm core
```
