I am trying to get hardware accelerated video working using libavcodec. I am using the hw_decode.c example as a starting point and am unable to get it to work. both AVCodecContext->hwaccel
and AVCodecContext->hwaccel_context
are NULL
I belive some part of the hwaccel is working as I see the output
libva info: VA-API version 0.39.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_0_39
libva info: va_openDriver() returns 0
Which is the same as when I run
ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i input.mpg -f null -
but immediately after that I get the following error message
[h264 @ 0x1df2cc0] Hardware acceleration context (hwaccel_context) does not exist.
Failed to get HW surface format.
[h264 @ 0x1df2cc0] decode_slice_header error
[h264 @ 0x1df2cc0] no frame!
I looked at the similar question and the answer to this shows how to get a AVCodecContext->hwaccel
. But even with the AVCodecContext->hwaccel
being a valid VAApih264 decoder I still get the same error message.
How do I initialize a AVCodecContext->hwaccel_context
and after that what else do I need to do to get hardware accelerated video working in ffmpeg?