Bug#910486: ffmpeg: vaapi encoding does not work
Package: ffmpeg
Version: 7:4.0.2-2+b1
Severity: normal
Dear Maintainer,
* What led up to the situation?
I am just following the FFmpeg wiki https://trac.ffmpeg.org/wiki/Hardware/VAAPI, and things are not working as documented.
* What exactly did you do
I first tried the simplest one which should "allows the decoder to work standlone to make decoding faster without any additional options", then I tried to feed the vaapi pixfmt to a vaapi encoder, but both are not working (see below)
* What was the outcome of this action?
For the first one:
$ ffmpeg -hwaccel vaapi -i cut.mp4 -c:v libx264 output.mp4 -y
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'cut.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.56.101
Duration: 00:00:19.99, start: 0.008005, bitrate: 451 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt470bg/unknown/unknown), 640x480 [SAR 1:1 DAR 4:3], 361 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 2k tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 111 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[AVHWFramesContext @ 0x7fc91004d2c0] Failed to read image from surface 0x4000018: 20 (the requested function is not implemented).
[h264 @ 0x55b57872fd00] Failed to transfer data to output frame: -5.
Error while processing the decoded data for stream #0:0
[aac @ 0x55b57872e4c0] Qavg: 1227.311
[aac @ 0x55b57872e4c0] 2 frames left in the queue on closing
Conversion failed!
For the second one:
$ ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -i cut.mp4 -c:v h264_vaapi output.mp4
...
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_vaapi))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
ffmpeg: i965_encoder.c:1692: intel_enc_hw_context_init: Assertion `encoder_context->mfc_context' failed.
* What outcome did you expect instead?
They should work...
FWIW:
The input is a short video cut in h264. Hardware decoding looks fine:
$ ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -i cut.mp4 -f null -
...
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> wrapped_avframe (native))
Stream #0:1 -> #0:1 (aac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, null, to 'pipe:':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.12.100
Stream #0:0(und): Video: wrapped_avframe, vaapi_vld, 640x480 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc58.18.100 wrapped_avframe
Stream #0:1(und): Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc58.18.100 pcm_s16le
frame= 542 fps=0.0 q=-0.0 Lsize=N/A time=00:00:20.08 bitrate=N/A speed= 194x
video:284kB audio:3444kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
$ lspci | grep Graphic
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 5500 (rev 09)
$ vainfo
libva info: VA-API version 1.2.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_2
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.2 (libva 2.2.0)
vainfo: Driver version: Intel i965 driver for Intel(R) Broadwell - 2.2.0
vainfo: Supported profile and entrypoints
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Simple : VAEntrypointEncSlice
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointEncSlice
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
VAProfileH264Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointEncSlice
VAProfileH264High : VAEntrypointVLD
VAProfileH264High : VAEntrypointEncSlice
VAProfileH264MultiviewHigh : VAEntrypointVLD
VAProfileH264StereoHigh : VAEntrypointVLD
VAProfileVC1Simple : VAEntrypointVLD
VAProfileVC1Main : VAEntrypointVLD
VAProfileVC1Advanced : VAEntrypointVLD
VAProfileJPEGBaseline : VAEntrypointVLD
VAProfileVP8Version0_3 : VAEntrypointVLD
$ apt list i965-va-driver
i965-va-driver/testing,now 2.2.0+dfsg1-2 amd64 [Installed, auto]
-- System Information:
Debian Release: buster/sid
APT prefers testing-debug
APT policy: (500, 'testing-debug'), (500, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 4.18.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=zh_CN.UTF-8, LC_CTYPE=zh_CN.UTF-8 (charmap=UTF-8), LANGUAGE=zh_CN:zh (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages ffmpeg depends on:
ii libavcodec58 7:4.0.2-2+b1
ii libavdevice58 7:4.0.2-2+b1
ii libavfilter7 7:4.0.2-2+b1
ii libavformat58 7:4.0.2-2+b1
ii libavresample4 7:4.0.2-2+b1
ii libavutil56 7:4.0.2-2+b1
ii libc6 2.27-6
ii libpostproc55 7:4.0.2-2+b1
ii libsdl2-2.0-0 2.0.8+dfsg1-4
ii libswresample3 7:4.0.2-2+b1
ii libswscale5 7:4.0.2-2+b1
ffmpeg recommends no packages.
Versions of packages ffmpeg suggests:
pn ffmpeg-doc <none>
-- no debconf information
Reply to: