hi @jimbobstpaul were you able to find any solutions for this?
I think I have a similar situation, I am trying to get ffmpeg to do AV1 encoding with the Intel Arc GPU. Worse still, I am trying to do it inside a Docker container so the methods I need to use are slightly more complicated than what you might need.
However I saw your thread here and I was wondering, what is the video output format you are targetting with ffmpeg?
I do not have AV1 encoding working yet, however, I got h264 and h265 / HEVC encoding working, inside my Docker container (which is running on Ubuntu 24.04)
The link to the Dockerfile is here ffmpeg-av1/intel_arc/Dockerfile at master · tazzuu/ffmpeg-av1 · GitHub
I will copy the contents here for clarity
FROM ubuntu:24.04
# actually we are using 0b097ed9f141f57e2b91f0704c721a9eff0204c0 because the latest version breaks with AV1 lib
# ENV FFMPEG_VERSION=7.1.1
ENV FFMPEG_VERSION=0b097ed9f141f57e2b91f0704c721a9eff0204c0
ENV SOURCE_DIR=/opt/ffmpeg_sources
ENV BUILD_DIR=/opt/ffmpeg_build
ENV BIN_DIR=/opt/bin
RUN mkdir -p $SOURCE_DIR $BIN_DIR
ENV PATH=$BIN_DIR:$PATH
RUN apt update && apt upgrade -y
RUN apt -y install \
build-essential \
git-core \
i965-va-driver \
libass-dev \
libfreetype6-dev \
libgnutls28-dev \
libunistring-dev \
libmp3lame-dev \
libsdl2-dev \
libtool \
libva-dev \
libvdpau-dev \
libvorbis-dev \
libfdk-aac-dev \
libopus-dev \
libvpl-dev \
libx264-dev \
libx265-dev \
libnuma-dev \
libvpx-dev \
libfdk-aac-dev \
libopus-dev \
libmfx-gen1.2 libmfx-tools \
libva-drm2 libva-x11-2 libva-wayland2 libva-glx2 vainfo intel-media-va-driver-non-free \
nasm \
wget
# Intel drivers
# https://dgpu-docs.intel.com/driver/client/overview.html
RUN wget -qO - https://repositories.intel.com/gpu/intel-graphics.key | \
gpg --yes --dearmor --output /usr/share/keyrings/intel-graphics.gpg
RUN echo \
"deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/gpu/ubuntu noble unified" | \
tee /etc/apt/sources.list.d/intel-gpu-noble.list
RUN apt update && apt-get install -y libze-intel-gpu1 libze1 intel-opencl-icd clinfo intel-gsc libze-dev intel-ocloc
# ffmpeg
# # NOTE THE GIT COMMIT USED HERE INSTEAD OF VERSION TAG
# # BECAUSE THE 7.1.1 RELEASE KEPT BREAKING ON SOME LIB
# NOTE: the repo is huge so we need to take drastic measures to not clone the whole thing
# while also keeping our Dockerfile pinned to a specific version
RUN cd $SOURCE_DIR && \
git init ffmpeg && \
cd ffmpeg && \
git remote add origin https://github.com/FFmpeg/FFmpeg.git && \
git fetch --depth=1 origin "$FFMPEG_VERSION" && \
git checkout "$FFMPEG_VERSION" && \
PATH="$BIN_DIR:$PATH" PKG_CONFIG_PATH="$BUILD_DIR/lib/pkgconfig" ./configure \
--prefix="$BUILD_DIR" \
--pkg-config-flags="--static" \
--extra-cflags="-I$BUILD_DIR/include" \
--extra-ldflags="-L$BUILD_DIR/lib" \
--extra-libs="-lpthread -lm" \
--ld="g++" \
--bindir="$BIN_DIR" \
--enable-gpl \
--enable-gnutls \
--enable-libass \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopus \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 \
--enable-libvpl \
--enable-version3 \
--enable-nonfree && \
PATH="$BIN_DIR:$PATH" make -j $(nproc) && \
make install -j $(nproc) && \
hash -r
# NOTE:
# --enable-libmfx \
# can not use libmfx and libvpl together
Keep in mind this is still a work in progress, so your mileage may vary here. But I think this should have all the packages and libraries needed to get a recent version of ffmpeg working
with Ubuntu 24.04 + Intel GPU. You mention that you have a NUC with Xe graphics ; I believe that it should be using the same drivers as my Intel Arc GPU… maybe. Actually, I also have a NUC 13 Pro with Xe graphics, I guess I will have to try it on there later. (btw good choice on the NUC, they are fantastic machines and punch above their weight for tasks like this)
For reference, all the docs I have used to get to this point are included linked on the README of that repo; GitHub - tazzuu/ffmpeg-av1: ffmpeg Dockerfile with AV1 encoding libraries included
I also included some example scripts to show how it works (replace input.mkv
with your input file)
- encode to h264 with Intel QSV; https:// github .com/tazzuu/ffmpeg-av1/blob/master/scripts/ffmpeg_h264-qsv.sh
#!/bin/bash
set -euo pipefail
CONTAINER="ffmpeg-av1:7.1.1-intel"
INTEL_PCI_NODE="$(lspci | grep 'VGA compatible controller: Intel Corporation' | cut -d ' ' -f1)"
INTEL_CARD="$(readlink -f /dev/dri/by-path/pci-0000:$INTEL_PCI_NODE-card)"
INTEL_RENDER="$(readlink -f /dev/dri/by-path/pci-0000:$INTEL_PCI_NODE-render)"
set -x
docker run --rm \
--device=$INTEL_CARD \
--device=$INTEL_RENDER \
--group-add video \
-v $PWD:$PWD \
-w $PWD \
-e MFX_ACCEL_MODE=VAAPI \
-e MFX_VAAPI_DEVICE=$INTEL_RENDER \
"$CONTAINER" \
ffmpeg -y \
-loglevel verbose \
-i input.mkv \
-init_hw_device vaapi=va:$INTEL_RENDER \
-c:v h264_qsv -c:a copy -c:s copy output.mkv
- encode to h265 / HEVC with Intel QSV https:// github .com/tazzuu/ffmpeg-av1/blob/master/scripts/ffmpeg_hevc-qsv.sh
#!/bin/bash
set -euo pipefail
CONTAINER="ffmpeg-av1:7.1.1-intel"
INTEL_PCI_NODE="$(lspci | grep 'VGA compatible controller: Intel Corporation' | cut -d ' ' -f1)"
INTEL_CARD="$(readlink -f /dev/dri/by-path/pci-0000:$INTEL_PCI_NODE-card)"
INTEL_RENDER="$(readlink -f /dev/dri/by-path/pci-0000:$INTEL_PCI_NODE-render)"
set -x
docker run --rm \
--device=$INTEL_CARD \
--device=$INTEL_RENDER \
--group-add video \
-v $PWD:$PWD \
-w $PWD \
-e MFX_ACCEL_MODE=VAAPI \
-e MFX_VAAPI_DEVICE=$INTEL_RENDER \
"$CONTAINER" \
ffmpeg -y \
-loglevel verbose \
-i input.mkv \
-init_hw_device vaapi=va:$INTEL_RENDER \
-c:v hevc_qsv -c:a copy -c:s copy output.mkv
You will note that I had to do some extra shenanigans to get the GPU passed into the Docker container correctly for this to work, if you are not using Docker you wouldnt need this but you may still need to direct ffmpeg to the address of your GPU on the PCIe bus. Or maybe not, I am not sure yet. And these scripts are just tests to make sure the encoding works, you would want to modify the final ffmpeg commands with the encoding arguments you want for your desired video settings (you already found the docs for that on the official ffmpeg site).
If you are not familiar with Docker do not worry, you can copy most of the commands shown in the Dockerfile and run them in your Ubuntu 24.04 system to get mostly the same effect. Docker is helpful here since it lets you keep the libraries needed for this specific installation & configuration of ffmpeg isolated from your global system, but its by no means a requirement. I just find it a lot easier to wrangle all these apt
packages using Docker instead of trying to manage them globally on the system (where, as you mentioned, messing up the wrong package could have bad side effects such as breaking things).
Let me know if any of this works for you. I am still trying to get AV1 to work (I suspect there is some issue related to this https:// github .com/intel/cartwheel-ffmpeg/issues/233 but not sure yet) but at the very least this should get you h264 and h265 encoding on your hardware hopefully.
proof that it worked for me;