Skip to content

Conversation

@ladaapp
Copy link
Contributor

@ladaapp ladaapp commented Jan 3, 2026

Adds support for Intel hardware-accelerated QSV encoders and decoders available for discrete (Arc) and integrated (Xe) Intel GPUs.

How to test

Check out this PR branch and build pyav-ffmpeg

cd pyav-ffmpeg
python -m venv .venv
source .venv/bin/activate
python scripts/build-ffmpeg.py pyav_ffmpeg_qsv_build
PYAV_FFMPEG_BUILD=$(pwd)/pyav_ffmpeg_qsv_build

Checkout PyAV and build it using the build artifacts from above

git clone https://github.com/PyAV-Org/PyAV.git
cd PyAV
python -m venv .venv
source .venv/bin/activate
pip install setuptools cython
python setup.py build_ext --inplace --ffmpeg-dir="$PYAV_FFMPEG_BUILD"

Check if qsv codecs show up

python -m av --codecs | grep qsv
 DEV.L. av1_qsv            AV1 (Intel Quick Sync Video acceleration)
 DEV.LS h264_qsv           H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (Intel Quick Sync Video acceleration)
 DEV.L. hevc_qsv           HEVC (Intel Quick Sync Video acceleration)
 DEVIL. mjpeg_qsv          MJPEG (Intel Quick Sync Video acceleration)
 DEV.L. mpeg2_qsv          MPEG-2 video (Intel Quick Sync Video acceleration)
 D.V.L. vc1_qsv            VC1 video (Intel Quick Sync Video acceleration)
 D.V.L. vp8_qsv            VP8 video (Intel Quick Sync Video acceleration)
 DEV.L. vp9_qsv            VP9 video (Intel Quick Sync Video acceleration)
 D.V.L. vvc_qsv            VVC video (Intel Quick Sync Video acceleration)

Similar to AMD or Nvidia codecs we need a runtime component to be able to use it. I installed these packages on ArchLinux. On other distros the package(s) may be named differently. I did not test on Windows.

sudo pacman -S libvpl vpl-gpu-rt

Test transcoding using h264_qsv encoder:

import av
import av.datasets

input_container = av.open(av.datasets.curated("pexels/time-lapse-video-of-night-sky-857195.mp4"))
output_container = av.open("h264_qsv_encoded.mp4", "w", options={})

input_stream = input_container.streams.video[0]
output_stream = output_container.add_stream('h264_qsv', input_stream.average_rate)
output_stream.width = input_stream.width
output_stream.height = input_stream.height
output_stream.pix_fmt = "nv12"

for frame in input_container.decode(video=0):
    packet = output_stream.encode(frame)
    if packet: output_container.mux(packet)

input_container.close()
output_container.close()

Documentation:

@ladaapp
Copy link
Contributor Author

ladaapp commented Jan 3, 2026

The CI currently doesn't work as nasm package cannot be downloaded as their website is down:

Failed to connect to www.nasm.us port 443: Connection timed out

I found this mirror and manually downloaded it to fix this locally on my system
https://distfiles.macports.org/nasm/nasm-2.16.03.tar.bz2

Let's hope the official nasm.us site comes back 🤞

@ladaapp
Copy link
Contributor Author

ladaapp commented Jan 4, 2026

@WyattBlue https://nasm.us/ now seems to be back online. Unfortunately it looks like that I don't have permissions to re-run the pipeline. Can you trigger that for me?

@WyattBlue WyattBlue merged commit a72f451 into PyAV-Org:main Jan 4, 2026
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants