Cannot hardware transcode from h265 to h264 using ffmpeg and vaapi

On a quick look something is fishy. Even on latest Intel Arc hardware which should support everything.

Can you test -vf 'scale_vaapi=w=-1:h=-1:format=nv12' and see if that works for you?

ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i P1000070.MP4 -vf 'scale_vaapi=w=-1:h=-1:format=nv12' -c:a copy -c:s copy -c:v h264_vaapi 'output.h264.mkv'

From what I understand there’s no 10 bit support for vaapi h.264, that’s why the encoder fails. The SW h.265 → HW h.264 does the conversion to 8 bit implicitly, that’s why it works. The HW h.265 → HW h.264 looks for a 10 bit encoder and fails. So you have to manually convert to 8 bit (nv12). But that transformation doesn’t seem to work on vaapi if you don’t tell the transformation pipeline we are using vaapi, therefore the “fake” call to scale_vaapi is necessary.

That’s the limit of my paygrade, it may be worth to ask for a more authoritative answer in the ffmpeg forum.

1 Like