diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..e011f54 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,39 @@ +name: DockerHub + +on: + push: + branches: + - 'main' + tags: + - '*' + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Docker meta + id: meta + uses: docker/metadata-action@v6 + with: + images: | + ffmpeglab/ffmpeg-dnn + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + - + name: Login to DockerHub + if: github.event_name != 'pull_request' + uses: docker/login-action@v4 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v7 + with: + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index f1775c3..ce72073 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,6 +43,7 @@ ENV \ MESA=26.2.4 \ NVCODEC=n13.1.15.0 \ OGG=1.3.6 \ + OPENVINO=2026.4.1 \ OPENCOREAMR=0.1.6 \ OPENJPEG=2.5.4 \ OPUS=1.6.1 \ @@ -100,6 +101,7 @@ RUN \ libmpg123-dev \ libpciaccess-dev \ libssl-dev \ + libtbb-dev \ libtool \ libv4l-dev \ libwayland-dev \ @@ -553,9 +555,54 @@ RUN \ meson setup \ --prefix=/usr --libdir=/usr/local/lib \ --buildtype release \ + -Denable_tests=false \ + -Denable_docs=false \ build && \ - ninja -vC build && \ + ninja -j2 -vC build && \ ninja -vC build install +RUN \ + echo "**** grabbing openvino ****" && \ + mkdir -p /tmp/openvino && \ + git clone \ + --branch ${OPENVINO} \ + --depth 1 \ + --recurse-submodules \ + --shallow-submodules \ + https://github.com/openvinotoolkit/openvino.git \ + /tmp/openvino +RUN \ + echo "**** compiling openvino ****" && \ + mkdir -p /tmp/openvino/build && \ + cd /tmp/openvino/build && \ + cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr/local \ + -DCPACK_GENERATOR=DEB \ + -DCMAKE_COMPILE_WARNING_AS_ERROR=OFF \ + -DENABLE_SYSTEM_TBB=ON \ + -DENABLE_TBBBIND_2_5=OFF \ + -DENABLE_INTEL_NPU=OFF \ + -DENABLE_PYTHON=OFF \ + -DENABLE_WHEEL=OFF \ + -DENABLE_JS=OFF \ + -DENABLE_SAMPLES=OFF \ + -DENABLE_TESTS=OFF \ + -DENABLE_DOCS=OFF \ + -DENABLE_OV_PADDLE_FRONTEND=OFF \ + -DENABLE_OV_PYTORCH_FRONTEND=OFF \ + -DENABLE_OV_TF_FRONTEND=OFF \ + -DENABLE_OV_TF_LITE_FRONTEND=OFF \ + -DENABLE_OV_JAX_FRONTEND=OFF \ + .. && \ + make +RUN \ + echo "**** installing openvino ****" && \ + cd /tmp/openvino/build && \ + make install && \ + ls -l /usr/lib/libopenvino*.so* /usr/lib/openvino-${OPENVINO}/ && \ + pkg-config --modversion openvino && \ + find /usr/lib -maxdepth 1 -name 'libopenvino*.so.*.*.*' -type f -exec strip -d {} + && \ + find /usr/lib/openvino-${OPENVINO} -name '*.so' -type f -exec strip -d {} + RUN \ echo "**** grabbing ogg ****" && \ mkdir -p /tmp/ogg && \ @@ -971,6 +1018,7 @@ RUN \ --enable-libopencore-amrnb \ --enable-libopencore-amrwb \ --enable-libopenjpeg \ + --enable-libopenvino \ --enable-libopus \ --enable-libplacebo \ --enable-librav1e \ @@ -1056,9 +1104,16 @@ RUN \ cp -a \ /usr/local/share/vulkan/* \ /buildout/usr/local/share/vulkan/ && \ + cp -a \ + /usr/lib/libopenvino*.so* \ + /buildout/usr/local/lib/ && \ + cp -a \ + /usr/lib/openvino-${OPENVINO} \ + /buildout/usr/local/lib/ && \ echo \ 'libnvidia-opencl.so.1' > \ /buildout/etc/OpenCL/vendors/nvidia.icd + # runtime stage FROM ghcr.io/linuxserver/baseimage-ubuntu:resolute @@ -1085,6 +1140,7 @@ RUN \ echo "**** install runtime ****" && \ apt-get update && \ apt-get install -y \ + libtbb12 \ libasound2t64 \ libedit2 \ libelf1t64 \ diff --git a/readme-vars.yml b/readme-vars.yml index f58c4f0..22907a4 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -166,6 +166,63 @@ full_custom_readme: | * ANV: To enable for Intel, set the env var `ANV_VIDEO_DECODE=1` * RADV: To enable on AMD, set the env var `RADV_PERFTEST=video_decode` * NVIDIA: To enable on Nvidia, install Nvidia Vulkan Beta drivers on the host per [this article](https://lynne.ee/vulkan-video-decoding.html#driver-support) + + ### OpenVINO (DNN inference, x86_64 only) + + 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). + + ```bash + docker run --rm -it \ + -v $(pwd):/config \ + -v /path/to/models:/models:ro \ + linuxserver/ffmpeg \ + -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). + + #### Selecting an adapter + + 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: + + ```bash + docker run --rm -it \ + --device=/dev/dri:/dev/dri \ + -v $(pwd):/config \ + -v /path/to/models:/models:ro \ + linuxserver/ffmpeg \ + -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): + + ```bash + docker run --rm -it \ + --device=/dev/dri:/dev/dri \ + -v $(pwd):/config \ + -v /path/to/models:/models:ro \ + linuxserver/ffmpeg \ + -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`. ## Building locally @@ -190,6 +247,7 @@ full_custom_readme: | ## Versions + * **26.11.26:** - Add support for OpenVINO (libopenvino) to x86_64, usable with the DNN filters (`dnn_processing`, `dnn_classify`, `dnn_detect`). * **12.10.26:** - Bump ffmpeg to 9.0.2. Also bump aom, fdk-aac, fribidi, harfbuzz, Intel drivers and libs, libdovi, libpng, libvmaf, mesa, shaderc, srt, vpx and vulkan-sdk. Make builds more resilient (curl retry). * **05.08.26:** - Rebase to Ubuntu Resolute. Bump ffmpeg to 9.0. Also bump harfbuzz, Intel drivers and libs, lame, libdav1d, libdovi, libvidstab, mesa, nvcodec, opus, rist, shaderc, srt, svtav1 and vulkan sdk. * **25.06.26:** - Bump ffmpeg to 8.1.2. Also bump aom, harfbuzz, libass, libdrm, libvmaf, mesa, rist and vulkan sdk.