Beginner
Quick introduction to using the core API and FFmpeg processes.
Last updated
Quick introduction to using the core API and FFmpeg processes.
Last updated
Starting the Core container
Configure and restart the Core
Creating, verifying, updating, and deleting an FFmpeg process
Using placeholders for the in-memory file system and RTMP server
Analyze FFmpeg process errors
docker run --detach --name core --publish 8080:8080 datarhei/core:latest
Configuring the Core via the API
Restarting the Core via the API and loading the changed configuration
Calling the RTMP API
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
}
}'
"OK"
curl http://127.0.0.1:8080/api/v3/config/reload \
-X GET
"OK"
curl http://127.0.0.1:8080/api/v3/rtmp \
-X GET
[]
Initiating the main-process using the Process API
Check the main-process via the Process API
Update the main-process via the Process API
Check the change of the main-process via the Process API
Monitor the RTMP stream via the RTMP API
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.
{
"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
}
}
curl http://127.0.0.1:8080/api/v3/process/main/state \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-X GET
{
"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", "-"]
}
The process is running if the exec state in the response is running and the progress.packet is increasing.
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.
{
"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
}
}
curl http://127.0.0.1:8080/api/v3/process/main/state \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-X GET
{
"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"]
}
curl http://127.0.0.1:8080/api/v3/rtmp \
-X GET
[{
"name": "/main"
}]
Now you can pull the stream from the RTMP server with the URL rtmp://127.0.0.1:1935/main
.
Initiate the sub-process through the Process API
Check the sub-process through the Process API
Monitor the HLS stream via the file system API
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.
{
"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
}
}
curl http://127.0.0.1:8080/api/v3/process/sub/state \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-X GET
{
"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"]
}
curl http://127.0.0.1:8080/api/v3/fs/mem \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-X GET
[{
"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
Now you can pull the stream from the in-memory filesystem with the URL http://127.0.0.1:8080/memfs/sub.m3u8
.
Stop the main-process through the Process API
Check the sub-process via process API
Analyze the sub-process log report via the Process API
Start the main-process through the Process API
Check the sub-process through the Process API
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.
"OK"
curl http://127.0.0.1:8080/api/v3/process/sub/state \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-X GET
{
"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"]
}
If a process has the order=start, does not return exec=running, and progress.packet is not ascending or >0, it indicates an error.
curl http://127.0.0.1:8080/api/v3/process/sub/report \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-X GE
{
"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.
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.
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.
"OK"
curl http://127.0.0.1:8080/api/v3/process/sub/state \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-X GET
{
"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"]
}
The exec status in the response is running again.
Stops and deletes the sub-process via the Process API
Stops and deletes the main-process via the Process API
curl http://127.0.0.1:8080/api/v3/process/sub \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-X DELETE
"OK"
curl http://127.0.0.1:8080/api/v3/process/main \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-X DELETE
"OK"
docker kill core
docker rm core