https://github.com/ffmpeglab/docker-ffmpeg
203
FFmpeg is built with --enable-libopenvino, so the dnn_processing, dnn_classify and dnn_detect filters can run models on the OpenVINO backend. Models must be in OpenVINO IR format (.xml + .bin) or ONNX. Bind mount your models directory into the container (read-only is fine).
docker run --rm -it \
-v $(pwd):/config \
-v /path/to/models:/models:ro \
ffmpeglab/ffmpeg-dnn \
-i /config/input.mkv \
-vf "dnn_processing=dnn_backend=openvino:model=/models/espcn.xml:input=x:output=y:backend_configs=device=CPU" \
-c:v libx264 \
-c:a copy \
/config/output.mkv
input and output must match the tensor names in the model (for example x and y for the ESPCN super-resolution model).
The inference device is set with device= inside backend_configs. Multiple options are separated with &.
| Device | Description | Extra docker args |
|---|---|---|
CPU | Default. Runs on any x86-64 CPU. | none |
GPU | Intel iGPU/dGPU (gen9+, Arc). Use GPU.0, GPU.1 to pick a specific card. | --device=/dev/dri:/dev/dri |
AUTO | Lets OpenVINO choose the best available device and fall back. | --device=/dev/dri:/dev/dri to allow GPU use |
Intel GPU example:
docker run --rm -it \
--device=/dev/dri:/dev/dri \
-v $(pwd):/config \
-v /path/to/models:/models:ro \
ffmpeglab/ffmpeg-dnn \
-i /config/input.mkv \
-vf "dnn_processing=dnn_backend=openvino:model=/models/espcn.xml:input=x:output=y:backend_configs=device=GPU&nireq=4" \
-c:v libx264 \
/config/output.mkv
Object detection with dnn_detect (bounding boxes are attached to frames as side data, so this example just benchmarks it):
docker run --rm -it \
--device=/dev/dri:/dev/dri \
-v $(pwd):/config \
-v /path/to/models:/models:ro \
ffmpeglab/ffmpeg-dnn \
-i /config/input.mkv \
-vf "dnn_detect=dnn_backend=openvino:model=/models/face-detection.xml:input=data:output=detection_out:confidence=0.6:backend_configs=device=AUTO" \
-f null - -benchmark
Useful backend_configs options: device, nireq (parallel inference requests), batch_size, input_resizable, layout, scale and mean.
docker pull ffmpeglab/ffmpeg-dnn:latest