Probe

Probing a process means to detect the vitals of the inputs of a process, e.g. frames, bitrate, codec, ... for each input and stream, e.g. a video file on disk may contain two video streams (low and high resolution, audio and subtitle streams in different languages).

A process must already exists before it can be probed. During probing only the global FFmpeg options and the inputs are used to construct the FFmpeg command line.

The probe returns an object with an array of the detected streams and any array of lines from the output from the ffmpeg command.

In the following example we assume the process config with these inputs for the process test. Parts that are not relevant for probing have been left out for brevity:

{
    "options": ["-err_detect", "ignore_err", "-y"],
    "input": [
      {
        "address": "testsrc2=rate=25:size=640x360",
        "id": "input_0",
        "options": ["-f", "lavfi", "-re"]
      },
      {
        "address": "anullsrc=r=44100:cl=stereo",
        "id": "input_1",
        "options": ["-f", "lavfi"]
      }
    ]
}

The expected result would be:

{
  "log": [
    "ffmpeg version 5.1.2 Copyright (c) 2000-2022 the FFmpeg developers",
    "  built with Apple clang version 14.0.0 (clang-1400.0.29.102)",
    "  configuration: --prefix=/usr/local/Cellar/ffmpeg/5.1.2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox",
    "  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",
    "Input #0, lavfi, from 'testsrc2=rate=25:size=640x360':",
    "  Duration: N/A, start: 0.000000, bitrate: N/A",
    "  Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn",
    "Input #1, lavfi, from 'anullsrc=r=44100:cl=stereo':",
    "  Duration: N/A, start: 0.000000, bitrate: 705 kb/s",
    "  Stream #1:0: Audio: pcm_u8, 44100 Hz, stereo, u8, 705 kb/s",
    "At least one output file must be specified"
  ],
  "streams": [
    {
      "bitrate_kbps": 0,
      "channels": 0,
      "codec": "rawvideo",
      "coder": "",
      "duration_sec": 0,
      "format": "lavfi",
      "fps": 0,
      "height": 360,
      "index": 0,
      "language": "und",
      "layout": "",
      "pix_fmt": "yuv420p",
      "sampling_hz": 0,
      "stream": 0,
      "type": "video",
      "url": "testsrc2=rate=25:size=640x360",
      "width": 640
    },
    {
      "bitrate_kbps": 705,
      "channels": 0,
      "codec": "pcm_u8",
      "coder": "",
      "duration_sec": 0,
      "format": "lavfi",
      "fps": 0,
      "height": 0,
      "index": 1,
      "language": "und",
      "layout": "stereo",
      "pix_fmt": "",
      "sampling_hz": 44100,
      "stream": 0,
      "type": "audio",
      "url": "anullsrc=r=44100:cl=stereo",
      "width": 0
    }
  ]
}

The field index refers to the input and the field stream refers to the stream of an input.

Example: probe the inputs of a process with the ID test:

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

Description:

Last updated