> For the complete documentation index, see [llms.txt](https://docs.datarhei.com/core/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.datarhei.com/core/api-ffmpeg/process/state.md).

# State

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 [Command](/core/api-ffmpeg/process/command.md)), 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:

```json
{
  "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:`

{% tabs %}
{% tab title="Curl" %}

```bash
curl http://127.0.0.1:8080/api/v3/process/test/state \
   -H 'accept: application/json' \
   -X GET
```

{% endtab %}

{% tab title="PyClient" %}

```python
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)
```

{% endtab %}

{% tab title="GoClient" %}

```go
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)
```

{% endtab %}
{% endtabs %}

Description:

{% openapi src="/files/AUmcih4nC1IX6QuhfO8m" path="/api/v3/process/{id}/state" method="get" %}
[doc.json](https://951110271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQRvnKSkK1SsZB0HeYhh%2Fuploads%2F3duUHhkhwH69BGLlHYga%2Fdoc.json?alt=media\&token=dcd2b063-c826-4652-9a98-c265ec41a469)
{% endopenapi %}
