State
Last updated
Was this helpful?
Last updated
Was this helpful?
The process state reflects the current vitals of an process. This includes for example the runtime the process is already in this state, the order (if it should be running or stopped, see ), the current CPU and memory consumption, the actual FFmpeg command line, and some more.
If the process is running you will recieve progress data additionally to the above mentioned metrics. Progress data includes for each input and output stream the bitrate, framerate, bytes read/written, the speed of the processing, duplicated, dropped frames, and so on.
In the following an example output for a running process:
{
"command": [
"-err_detect",
"ignore_err",
"-y",
"-f",
"lavfi",
"-re",
"-i",
"testsrc2=rate=25:size=640x360",
"-f",
"lavfi",
"-i",
"anullsrc=r=44100:cl=stereo",
"-dn",
"-sn",
"-map",
"0:0",
"-codec:v",
"libx264",
"-preset:v",
"ultrafast",
"-b:v",
"1024k",
"-maxrate:v",
"1024k",
"-bufsize:v",
"1024k",
"-r",
"25",
"-sc_threshold",
"0",
"-pix_fmt",
"yuv420p",
"-g",
"50",
"-keyint_min",
"50",
"-fps_mode",
"cfr",
"-tune:v",
"zerolatency",
"-map",
"1:0",
"-filter:a",
"aresample=osr=44100:ochl=stereo",
"-codec:a",
"aac",
"-b:a",
"64k",
"-shortest",
"-flags",
"+global_header",
"-tag:v",
"7",
"-tag:a",
"10",
"-f",
"tee",
"[f=hls:start_number=0:hls_time=2:hls_list_size=6:hls_flags=append_list+delete_segments+program_date_time+independent_segments+temp_file:hls_delete_threshold=4:hls_segment_type=fmp4:hls_fmp4_init_filename=f13d9ff4-8ac1-458d-8d61-6e7d8ad06faf.mp4:hls_fmp4_init_resend=1:hls_segment_filename=http\\\\://admin\\\\:xxx@localhost\\\\:8080/memfs/f13d9ff4-8ac1-458d-8d61-6e7d8ad06faf_output_0_%04d.mp4:master_pl_name=f13d9ff4-8ac1-458d-8d61-6e7d8ad06faf.m3u8:master_pl_publish_rate=2:method=PUT]http://admin:xxx@localhost:8080/memfs/f13d9ff4-8ac1-458d-8d61-6e7d8ad06faf_output_0.m3u8|[f=flv]rtmp://localhost:1935/live/f13d9ff4-8ac1-458d-8d61-6e7d8ad06faf.stream?token=foobar|[f=mpegts]srt://localhost:6000?mode=caller\u0026transtype=live\u0026streamid=f13d9ff4-8ac1-458d-8d61-6e7d8ad06faf,mode:publish,token:abc"
],
"cpu_usage": 3.022,
"exec": "running",
"last_logline": "[hls @ 0x7fa31f810240] Opening 'http://admin:xxx@localhost:8080/memfs/f13d9ff4-8ac1-458d-8d61-6e7d8ad06faf.mp4' for writing",
"memory_bytes": 21532672,
"order": "start",
"progress": {
"bitrate_kbit": 0,
"drop": 0,
"dup": 0,
"fps": 24.833,
"frame": 62221,
"inputs": [
{
"address": "testsrc2=rate=25:size=640x360",
"avstream": null,
"bitrate_kbit": 0,
"codec": "rawvideo",
"coder": "",
"format": "lavfi",
"fps": 0,
"frame": 0,
"height": 360,
"id": "input_0",
"index": 0,
"packet": 0,
"pix_fmt": "yuv420p",
"pps": 0,
"size_kb": 0,
"stream": 0,
"type": "video",
"width": 640
},
{
"address": "anullsrc=r=44100:cl=stereo",
"avstream": null,
"bitrate_kbit": 0,
"codec": "pcm_u8",
"coder": "",
"format": "lavfi",
"fps": 0,
"frame": 0,
"id": "input_1",
"index": 1,
"layout": "stereo",
"packet": 0,
"pps": 0,
"sampling_hz": 44100,
"size_kb": 0,
"stream": 0,
"type": "audio"
}
],
"outputs": [
{
"address": "[f=hls:start_number=0:hls_time=2:hls_list_size=6:hls_flags=append_list+delete_segments+program_date_time+independent_segments+temp_file:hls_delete_threshold=4:hls_segment_type=fmp4:hls_fmp4_init_filename=f13d9ff4-8ac1-458d-8d61-6e7d8ad06faf.mp4:hls_fmp4_init_resend=1:hls_segment_filename=http\\\\://admin\\\\:xxx@localhost\\\\:8080/memfs/f13d9ff4-8ac1-458d-8d61-6e7d8ad06faf_output_0_%04d.mp4:master_pl_name=f13d9ff4-8ac1-458d-8d61-6e7d8ad06faf.m3u8:master_pl_publish_rate=2:method=PUT]http://admin:xxx@localhost:8080/memfs/f13d9ff4-8ac1-458d-8d61-6e7d8ad06faf_output_0.m3u8|[f=flv]rtmp://localhost:1935/live/f13d9ff4-8ac1-458d-8d61-6e7d8ad06faf.stream?token=foobar|[f=mpegts]srt://localhost:6000?mode=caller\u0026transtype=live\u0026streamid=f13d9ff4-8ac1-458d-8d61-6e7d8ad06faf,mode:publish,token:abc",
"avstream": null,
"bitrate_kbit": 0,
"codec": "h264",
"coder": "",
"format": "tee",
"fps": 0,
"frame": 0,
"height": 360,
"id": "output_0",
"index": 0,
"packet": 0,
"pix_fmt": "yuv420p",
"pps": 0,
"size_kb": 0,
"stream": 0,
"type": "video",
"width": 640
},
{
"address": "[f=hls:start_number=0:hls_time=2:hls_list_size=6:hls_flags=append_list+delete_segments+program_date_time+independent_segments+temp_file:hls_delete_threshold=4:hls_segment_type=fmp4:hls_fmp4_init_filename=f13d9ff4-8ac1-458d-8d61-6e7d8ad06faf.mp4:hls_fmp4_init_resend=1:hls_segment_filename=http\\\\://admin\\\\:xxx@localhost\\\\:8080/memfs/f13d9ff4-8ac1-458d-8d61-6e7d8ad06faf_output_0_%04d.mp4:master_pl_name=f13d9ff4-8ac1-458d-8d61-6e7d8ad06faf.m3u8:master_pl_publish_rate=2:method=PUT]http://admin:xxx@localhost:8080/memfs/f13d9ff4-8ac1-458d-8d61-6e7d8ad06faf_output_0.m3u8|[f=flv]rtmp://localhost:1935/live/f13d9ff4-8ac1-458d-8d61-6e7d8ad06faf.stream?token=foobar|[f=mpegts]srt://localhost:6000?mode=caller\u0026transtype=live\u0026streamid=f13d9ff4-8ac1-458d-8d61-6e7d8ad06faf,mode:publish,token:abc",
"avstream": null,
"bitrate_kbit": 0,
"codec": "aac",
"coder": "",
"format": "tee",
"fps": 0,
"frame": 0,
"id": "output_0",
"index": 0,
"layout": "stereo",
"packet": 0,
"pps": 0,
"sampling_hz": 44100,
"size_kb": 0,
"stream": 1,
"type": "audio"
}
],
"packet": 0,
"q": 29,
"size_kb": 0,
"speed": 1,
"time": 2488.84
},
"reconnect_seconds": -1,
"runtime_seconds": 2489
}
Example: read the state of a process with the ID test:
curl http://127.0.0.1:8080/api/v3/process/test/state \
-H 'accept: application/json' \
-X GET
from core_client import Client
client = Client(
base_url="http://127.0.0.1:8080"
)
client.login()
core_process_test_state = client.v3_process_get_state(
id="test"
)
print(core_process_test_state)
import (
"fmt"
"github.com/datarhei/core-client-go/v16"
)
client, _ := coreclient.New(coreclient.Config{
Address: "https://127.0.0.1:8080",
})
state, err := client.ProcessState("test")
if err != nil {
...
}
fmt.Printf("%+v\n", state)
Description:
Get the state and progress data of a process.
Process ID
GET /v3/process/{id}/state HTTP/1.1
Host: api
Authorization: YOUR_API_KEY
Accept: */*
{
"command": [
"text"
],
"cpu_usage": 1,
"exec": "text",
"last_logline": "text",
"memory_bytes": 1,
"order": "text",
"progress": {
"bitrate_kbit": 1,
"drop": 1,
"dup": 1,
"fps": 1,
"frame": 1,
"inputs": [
{
"address": "text",
"avstream": {
"aqueue": 1,
"drop": 1,
"dup": 1,
"duplicating": true,
"enc": 1,
"gop": "text",
"input": {
"packet": 1,
"size_kb": 1,
"state": "running",
"time": 1
},
"looping": true,
"output": {
"packet": 1,
"size_kb": 1,
"state": "running",
"time": 1
},
"queue": 1
},
"bitrate_kbit": 1,
"channels": 1,
"codec": "text",
"coder": "text",
"format": "text",
"fps": 1,
"frame": 1,
"height": 1,
"id": "text",
"index": 1,
"layout": "text",
"packet": 1,
"pix_fmt": "text",
"pps": 1,
"q": 1,
"sampling_hz": 1,
"size_kb": 1,
"stream": 1,
"type": "text",
"width": 1
}
],
"outputs": [
{
"address": "text",
"avstream": {
"aqueue": 1,
"drop": 1,
"dup": 1,
"duplicating": true,
"enc": 1,
"gop": "text",
"input": {
"packet": 1,
"size_kb": 1,
"state": "running",
"time": 1
},
"looping": true,
"output": {
"packet": 1,
"size_kb": 1,
"state": "running",
"time": 1
},
"queue": 1
},
"bitrate_kbit": 1,
"channels": 1,
"codec": "text",
"coder": "text",
"format": "text",
"fps": 1,
"frame": 1,
"height": 1,
"id": "text",
"index": 1,
"layout": "text",
"packet": 1,
"pix_fmt": "text",
"pps": 1,
"q": 1,
"sampling_hz": 1,
"size_kb": 1,
"stream": 1,
"type": "text",
"width": 1
}
],
"packet": 1,
"q": 1,
"size_kb": 1,
"speed": 1,
"time": 1
},
"reconnect_seconds": 1,
"runtime_seconds": 1
}