Skip to main content

Encode with Intel Quick Sync Video (QSV)

Select device = "qsv" on a transcoder and use a QSV-capable Packager build with access to the Intel GPU. Automatic device selection considers QSV only when the environment variable QSV_AUTO_SELECT is set; see Device selection. Audio remains a separate software encoding path.

note

Intel QSV runs in a dedicated Packager image variant with the Intel media stack. Ask which integrations it includes when you request it. Contact Vindral support for access.

Prepare the Linux host and image​

The host needs a supported Intel GPU, its kernel driver and a usable DRM render node. The image needs Intel user-space media drivers, a compatible QSV runtime (oneVPL or Media SDK as appropriate to its FFmpeg build), and the required FFmpeg QSV encoders/decoders and filters. GPU generation and driver build determine which codecs the GPU encodes and decodes. See the Intel media driver support matrix.

Check the intended render node on the host, adjusting this path to your device:

bash
ls -l /dev/dri
vainfo --display drm --device /dev/dri/renderD128

vainfo is an optional host diagnostic. It tests VA-API driver access, not the Packager's complete QSV pipeline. For images using Intel's iHD media driver, LIBVA_DRIVER_NAME=iHD selects that driver; the matching library must also exist inside the image. Follow your release's driver/runtime requirements.

If the supplied image includes the FFmpeg CLI, inspect its build through an entrypoint override:

bash
docker run --rm --entrypoint ffmpeg \
"${PACKAGER_IMAGE:?Set PACKAGER_IMAGE to your release image}" -hide_banner -hwaccels
docker run --rm --entrypoint ffmpeg \
"${PACKAGER_IMAGE:?Set PACKAGER_IMAGE to your release image}" -hide_banner -h encoder=h264_qsv
docker run --rm --entrypoint ffmpeg \
"${PACKAGER_IMAGE:?Set PACKAGER_IMAGE to your release image}" -hide_banner -h decoder=h264_qsv
docker run --rm --entrypoint ffmpeg \
"${PACKAGER_IMAGE:?Set PACKAGER_IMAGE to your release image}" -hide_banner -h filter=vpp_qsv

These are build checks. Images without an FFmpeg executable must be checked using the supplied build manifest and Packager startup logs instead.

Run the complete example​

Generate the workflow fixtures, download intel-qsv.toml as config.toml, and set PACKAGER_IMAGE to a QSV-capable image (see the note above). This example reads H.264/AAC camera-a.mp4, encodes 640×360 H.264 using h264_qsv and stereo AAC, then sends the result over SRT.

For the common single-Intel-GPU Linux setup:

bash
docker run --rm --name packager-qsv \
--device /dev/dri:/dev/dri \
--group-add "$(stat -c '%g' /dev/dri/renderD128)" \
-e LIBVA_DRIVER_NAME=iHD \
-p 127.0.0.1:4040:4040 \
-p 10000:10000/udp \
-v "$(pwd)/config.toml:/etc/packager/config.toml:ro" \
-v "$(pwd)/media:/media:ro" \
"${PACKAGER_IMAGE:?Set PACKAGER_IMAGE to your release image}" start

The numeric supplementary group grants access to the render node for a non-root container user. Ensure that user can also write the output mount.

Device selection​

Device selection is set through environment variables, not the configuration file:

VariableEffect
QSV_CHILD_DEVICERender node used for QSV by all transcoders in the process, for example /dev/dri/renderD128. Set it on any host with more than one render node.
QSV_AUTO_SELECT1, true or yes (any case) lets automatic device selection choose QSV. The Packager checks once per process that a QSV session can be created. Devices with load measurements rank first, then QSV, then CPU.

An explicit device = "qsv" does not need QSV_AUTO_SELECT. Identify the Intel render node by its PCI vendor ID 0x8086 rather than by device number:

bash
for node in /sys/class/drm/renderD*; do
printf '%s: ' "${node##*/}"
cat "$node/device/vendor"
done

Pass the node into the container at its original path, together with the variable:

bash
export QSV_CHILD_DEVICE=/dev/dri/renderD128
docker run --rm --name packager-qsv \
--device "$QSV_CHILD_DEVICE" -e QSV_CHILD_DEVICE \
--group-add "$(stat -c '%g' "$QSV_CHILD_DEVICE")" \
-e LIBVA_DRIVER_NAME=iHD \
-p 127.0.0.1:4040:4040 -p 10000:10000/udp \
-v "$(pwd)/config.toml:/etc/packager/config.toml:ro" \
-v "$(pwd)/media:/media:ro" \
"${PACKAGER_IMAGE:?Set PACKAGER_IMAGE to your release image}" start

Encoder, decoder and filter selection​

The important settings in the complete configuration are:

toml
[[transcoders]]
id = "encode"
source_ids = ["input"]
device = "qsv"

[[transcoders.tracks]]
id = "video"
type = "video"
track_selector = { type = "track-kind", kind = "video" }
decoder = { hw_frames_enabled = true }
processing = { hw_filtering_enabled = true }

[[transcoders.tracks.renditions]]
id = "video-output"
codec = "h264"
encoder_name = "h264_qsv"
bit_rate = 1_000_000
gop_size_ms = 1000
max_b_frames = 0
format = "nv12"
size = { width = 640, height = 360 }

Hardware frames and filtering already default to enabled. The QSV capability mapping prefers h264_qsv, hevc_qsv, av1_qsv and vp9_qsv for decoding and encoding, and mjpeg_qsv for MJPEG encoding, when the build has them. For HEVC or AV1 output, check that the GPU, image and destination support the codec, then change the rendition's codec and encoder (hevc_qsv, av1_qsv). The surface format follows the input bit depth (NV12 for 8-bit, P010 above), so 10-bit input reaches the HEVC, AV1 and VP9 encoders.

nv12 is the 8-bit software pixel layout used by this H.264 example; hardware surfaces are managed by the QSV path. Scaling uses vpp_qsv when available; interlaced processing uses deinterlace_qsv. For software-only filters, disable processing.hw_filtering_enabled as appropriate and account for frame transfers. Selecting QSV on an encoder does not turn CPU overlays into QSV filters; use the overlay_qsv node for that (see Browser overlay on QSV).

Encoder-specific tuning goes in rendition options; it is distinct from transcoder device selection. Packager defaults for QSV encoders:

EncoderDefaults
All QSV encodersasync_depth=1, preset=veryfast, bf=0; forced_idr=1 when gop_alignment is set
h264_qsvlow_power=false; profile=baseline for 8-bit 4:2:0 input
hevc_qsvprofile=main, or main10 above 8 bits
av1_qsvprofile=main
vp9_qsvprofile=profile0, or profile2 above 8 bits
mjpeg_qsvglobal_quality=90

bf=0 disables B-frames; a bf in the rendition options, or max_b_frames on the rendition, takes precedence. Override defaults only with options supported by the supplied build; see FFmpeg QSV encoder options. Do not carry over libx264-specific options such as tune=zerolatency.

Browser overlay on QSV​

The overlay_qsv compositor node blends a browser source over a live source on the Intel GPU. QSV decodes the base video, uploads the browser's BGRA frames, blends them with per-pixel alpha and encodes with h264_qsv, without copying frames back to system memory. The page itself is still rendered in software.

This needs the browser engine and QSV FFmpeg in the same image. Ask Vindral for the QSV image variant with the browser engine included.

The QSV-specific parts of the configuration:

toml
# Decode the live source and the browser page to QSV frames.
[[transcoders]]
id = "main-decoder"
source_ids = ["main"]
device = "qsv"

[[transcoders.tracks]]
type = "video"
id = "main-video"
processing = { hw_filtering_enabled = true }
track_selector = { type = "track-kind", kind = "video" }

[[transcoders.tracks.renditions]]
id = "main-raw"
codec = "wrapped_avframe"
format = "qsv"

# overlay-decoder: the same shape, with source_ids = ["browser-overlay"].

[[compositors]]
id = "compositor"

[[compositors.video.sources]]
id = "base"
source_id = "main-decoder"
track_selector = { type = "track-kind", kind = "video" }

[[compositors.video.sources]]
id = "overlay"
source_id = "overlay-decoder"
track_selector = { type = "track-kind", kind = "video" }

[[compositors.video.nodes]]
type = "overlay_qsv"
id = "browser-overlay"
source_ids = ["base", "overlay"]
x = "0"
y = "0"
output_format = "qsv"

An encoding transcoder with device = "qsv" and source_ids = ["compositor"] then encodes the result. All QSV stages on one render node share one device context, which overlay_qsv needs because both inputs must be on the same device. Keep the browser rendition at the page's size: a same-size QSV upload keeps the BGRA alpha channel, unless the source is deinterlaced. overlay_qsv accepts x, y, w, h and alpha (0–255) and no runtime commands. See the [[compositors]] reference.

Verify acceleration and troubleshoot​

Inspect startup logs for the selected device, decoder and h264_qsv encoder, connect the SRT receiver, then confirm the transcoder and sink start and output counters advance. Check the received stream for H.264 640×360 video and stereo AAC. ffprobe confirms the media format; it cannot distinguish a software H.264 encoder from QSV. Combine Packager logs with Intel GPU activity monitoring when validating acceleration and throughput.

SymptomCheck
Cannot create QSV device/sessionDRM access, container group, kernel driver and compatible user-space runtime.
Unknown QSV encoder/decoder/filterImage build capabilities; installing a host driver does not add missing image plugins.
Unsupported format/profile or initialization errorGPU codec support, input bit depth/chroma, NV12 output and encoder options.
Software encoder selectedExplicit device = "qsv" and the rendition's encoder_name; remove an inherited libx264 selection.
Frames fail around a software filterHardware/software frame boundary and filtering settings.

For a CPU baseline, change the device to cpu, encoder to libx264, output format to yuv420p and remove QSV-specific options. Compare the same input and output settings, and measure on your deployment image and GPU to set a capacity baseline.

Complete configuration​

toml
# Vindral Bridge Packager example
# Encode a file with Intel Quick Sync Video and send it over SRT.

version = "3"

[[sources]]
id = "input"
source_type = "file"
realtime_pacing = true
protocol_options = { url = "/media/camera-a.mp4" }

[[transcoders]]
id = "encode"
source_ids = ["input"]
device = "qsv"

[[transcoders.tracks]]
id = "video"
type = "video"
track_selector = { type = "track-kind", kind = "video", is_required = true }

[[transcoders.tracks.renditions]]
id = "video-output"
codec = "h264"
encoder_name = "h264_qsv"
bit_rate = 1_000_000
gop_size_ms = 1000
max_b_frames = 0
format = "nv12"
size = { width = 640, height = 360 }

[[transcoders.tracks]]
id = "audio"
type = "audio"
track_selector = { type = "track-kind", kind = "audio", is_required = true }

[[transcoders.tracks.renditions]]
id = "audio-output"
codec = "aac"
sample_rate = 48_000
channels = 2
bit_rate = 128_000

[[sinks]]
id = "srt"
sink_type = "srt"
source_ids = ["encode"]
wait_for_all_sources = true
protocol_options = { url = "srt://0.0.0.0:10000?mode=listener&latency=120000" }