Skip to content

hardware: bind vaapi filter device for FFmpeg 8 - #2374

Open
kugaevsky wants to merge 1 commit into
AlexxIT:masterfrom
kugaevsky:ffmpeg-vaapi-device
Open

hardware: bind vaapi filter device for FFmpeg 8#2374
kugaevsky wants to merge 1 commit into
AlexxIT:masterfrom
kugaevsky:ffmpeg-vaapi-device

Conversation

@kugaevsky

Copy link
Copy Markdown

hardware: bind vaapi filter device for FFmpeg 8

Problem

#hardware=vaapi transcoding is broken on FFmpeg 8. The VAAPI branch of
MakeHardware inserts a format=vaapi|nv12,hwupload filter but relies on
-hwaccel vaapi to provide the device to the filter graph. FFmpeg 8 no
longer derives the filter device from -hwaccel alone, so hwupload fails
whenever the input isn't hardware-decoded (e.g. an RTSP restream):

[hwupload] A hardware device reference is required to upload frames to.
[AVFilterGraph] Error initializing filters
Error opening output files: Invalid argument

Note the hardware probe commands already work, because they explicitly
-init_hw_device vaapi — the transcode path just didn't.

Fix

Explicitly initialise and bind a filter device in the VAAPI branch, matching
the probes:

-init_hw_device vaapi=vaapi0 -filter_hw_device vaapi0 -hwaccel vaapi ...

Applied to both VAAPI sub-branches (with and without drawtext).

Testing

Reproduced and A/B-tested on an Intel N150 (iHD driver), FFmpeg 8.0.1, same
input stream (ffmpeg:virtual?video#video=h264#hardware=vaapi):

build result
master [hwupload] A hardware device reference is required → stream fails
this PR h264 1920x1080 — encodes fine

Also verified end-to-end transcoding a live H265 doorbell stream to H264 for a
browser that can't decode HEVC.

Question

-init_hw_device vaapi=vaapi0 auto-selects the DRM node (same as the probe
commands). If you'd rather thread through an explicit device path, happy to
adjust.

The VAAPI transcode inserts a "hwupload" filter but relied on -hwaccel
to provide the device to the filter graph. Since FFmpeg 8 that no longer
happens, so hwupload fails with "A hardware device reference is required
to upload frames to" whenever the input isn't hardware decoded (e.g. an
RTSP restream). Explicitly -init_hw_device / -filter_hw_device, matching
what the hardware probe commands already do.
@kugaevsky
kugaevsky force-pushed the ffmpeg-vaapi-device branch from 94a8642 to 0c1d68c Compare July 21, 2026 06:53
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.

1 participant