[FFmpeg-user] VAAPI encoding error

Mark Thompson sw at jkqxz.net
Tue Jun 19 01:23:30 EEST 2018


On 18/06/18 21:32, Victor Helmholtz wrote:
> Hi,
> 
> I am trying to encode raw yuv file using VAAPI hardware acceleration on a machine with i7-6700 CPU running Debian 9 “Stretch” but I am getting error “A hardware frames reference is required to associate the encoding device.”. I have searched internet but couldn’t find anything related to this error message. I have attached log with the error. Could anyone suggest solution for this problem?
> 
> Thanks
> Victor
> 
> 
> $ ffmpeg -loglevel debug -c:v rawvideo -pix_fmt yuv420p -video_size 1920x1080 -i test.yuv -vaapi_device /dev/dri/renderD128 -vf 'format=yuv420p,hwupload' -c:v h264_vaapi test.h264

This command doesn't work for me on any driver I know of because hardware H.264 encoders generally use NV12 rather than YUV420P - changing "format=yuv420p" to "format=nv12" does work on both Intel / i965 and AMD / Mesa.  However, it doesn't fail in the way you show below so there is another problem:

> ffmpeg version 3.2.10-1~deb9u1 Copyright (c) 2000-2018 the FFmpeg developers
>   built with gcc 6.3.0 (Debian 6.3.0-18) 20170516
>   configuration: --prefix=/usr --extra-version='1~deb9u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
>   WARNING: library configuration mismatch

This - you have an old dynamically-linked ffmpeg binary which doesn't match the shared libraries it's being used with.  I'm not entirely sure why it gives the error it does, but that is effectively not a supported configuration so please fix it before continuing.

>   avutil      configuration: --prefix=/usr --extra-version=2+b2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
> ...
>   libavutil      55. 34.101 / 55. 78.100
>   libavcodec     57. 64.101 / 57.107.100
>   libavformat    57. 56.101 / 57. 83.100
>   libavdevice    57.  1.100 / 57. 10.100
>   libavfilter     6. 65.100 /  6.107.100
>   libavresample   3.  1.  0 /  3.  7.  0
>   libswscale      4.  2.100 /  4.  8.100
>   libswresample   2.  3.100 /  2.  9.100
>   libpostproc    54.  1.100 / 54.  7.100
> Splitting the commandline.
> Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
> Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'rawvideo'.
> Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument 'yuv420p'.
> Reading option '-video_size' ... matched as AVOption 'video_size' with argument '1920x1080'.
> Reading option '-i' ... matched as input url with argument 'test.yuv'.
> Reading option '-vaapi_device' ... matched as option 'vaapi_device' (set VAAPI hardware device (DRM path or X11 display name)) with argument '/dev/dri/renderD128'.
> Reading option '-vf' ... matched as option 'vf' (set video filters) with argument 'format=yuv420p,hwupload'.
> Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'h264_vaapi'.
> Reading option 'test.h264' ... matched as output url.
> Finished splitting the commandline.
> Parsing a group of options: global .
> Applying option loglevel (set logging level) with argument debug.
> Applying option vaapi_device (set VAAPI hardware device (DRM path or X11 display name)) with argument /dev/dri/renderD128.
> [AVHWDeviceContext @ 0x5595d11d9ba0] Opened VA display via DRM device /dev/dri/renderD128.
> libva info: VA-API version 0.39.4
> 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_0_39
> libva info: va_openDriver() returns 0
> [AVHWDeviceContext @ 0x5595d11d9ba0] Initialised VAAPI connection: version 0.39
> [AVHWDeviceContext @ 0x5595d11d9ba0] Format 0x32315659 -> yuv420p.
> [AVHWDeviceContext @ 0x5595d11d9ba0] Format 0 -> unknown.
> [AVHWDeviceContext @ 0x5595d11d9ba0] Format 0x32595559 -> yuyv422.
> [AVHWDeviceContext @ 0x5595d11d9ba0] Format 0 -> unknown.
> [AVHWDeviceContext @ 0x5595d11d9ba0] Format 0x58424752 -> rgb0.
> [AVHWDeviceContext @ 0x5595d11d9ba0] Format 0xff0000 -> unknown.
> [AVHWDeviceContext @ 0x5595d11d9ba0] Format 0 -> unknown.
>     Last message repeated 2 times
> [AVHWDeviceContext @ 0x5595d11d9ba0] Matched "Intel i965 driver for Intel(R) Skylake - 1.7.3" as known driver "Intel i965 (Quick Sync)".
> Successfully parsed a group of options.
> Parsing a group of options: input url test.yuv.
> Applying option c:v (codec name) with argument rawvideo.
> Applying option pix_fmt (set pixel format) with argument yuv420p.
> Successfully parsed a group of options.
> Opening an input file: test.yuv.
> [NULL @ 0x5595d11e7c00] Opening 'test.yuv' for reading
> [file @ 0x5595d11e8640] Setting default whitelist 'file,crypto'
> [rawvideo @ 0x5595d11e7c00] Format rawvideo probed with size=2048 and score=50
> [rawvideo @ 0x5595d11e7c00] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:1
> [rawvideo @ 0x5595d11e7c00] All info found
> [rawvideo @ 0x5595d11e7c00] Estimating duration from bitrate, this may be inaccurate
> [rawvideo @ 0x5595d11e7c00] After avformat_find_stream_info() pos: 3110400 bytes read:3110400 seeks:0 frames:1
> Input #0, rawvideo, from 'test.yuv':
>   Duration: 00:00:12.00, start: 0.000000, bitrate: 622080 kb/s
>     Stream #0:0, 1, 1/25: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 1920x1080, 0/1, 622080 kb/s, 25 tbr, 25 tbn, 25 tbc
> Successfully opened the file.
> Parsing a group of options: output url test.h264.
> Applying option vf (set video filters) with argument format=yuv420p,hwupload.
> Applying option c:v (codec name) with argument h264_vaapi.
> Successfully parsed a group of options.
> Opening an output file: test.h264.
> [file @ 0x5595d11ee580] Setting default whitelist 'file,crypto'
> Successfully opened the file.
> detected 8 logical cores
> [Parsed_format_0 @ 0x5595d11efb40] compat: called with args=[yuv420p]
> [Parsed_format_0 @ 0x5595d11efb40] Setting 'pix_fmts' to value 'yuv420p'
> [graph 0 input from stream 0:0 @ 0x5595d11ed480] Setting 'video_size' to value '1920x1080'
> [graph 0 input from stream 0:0 @ 0x5595d11ed480] Setting 'pix_fmt' to value '0'
> [graph 0 input from stream 0:0 @ 0x5595d11ed480] Setting 'time_base' to value '1/25'
> [graph 0 input from stream 0:0 @ 0x5595d11ed480] Setting 'pixel_aspect' to value '0/1'
> [graph 0 input from stream 0:0 @ 0x5595d11ed480] Setting 'sws_param' to value 'flags=2'
> [graph 0 input from stream 0:0 @ 0x5595d11ed480] Setting 'frame_rate' to value '25/1'
> [graph 0 input from stream 0:0 @ 0x5595d11ed480] w:1920 h:1080 pixfmt:yuv420p tb:1/25 fr:25/1 sar:0/1 sws_param:flags=2
> [format @ 0x5595d11f9840] compat: called with args=[vaapi_vld]
> [format @ 0x5595d11f9840] Setting 'pix_fmts' to value 'vaapi_vld'
> [AVFilterGraph @ 0x5595d11ee600] query_formats: 5 queried, 4 merged, 0 already done, 0 delayed
> [hwupload @ 0x5595d11f0280] Surface format is yuv420p.
> [AVHWFramesContext @ 0x5595d11fcc20] Created surface 0x4000000.
> [AVHWFramesContext @ 0x5595d11fcc20] Direct mapping possible.
> [h264_vaapi @ 0x5595d11ec2c0] A hardware frames reference is required to associate the encoding device.
> Stream mapping:
>   Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_vaapi))
> Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
> [AVIOContext @ 0x5595d11ed740] Statistics: 0 seeks, 0 writeouts
> [AVIOContext @ 0x5595d11f0a80] Statistics: 3110400 bytes read, 0 seeks


More information about the ffmpeg-user mailing list