On 01/12/17 16:48, Devin Heitmueller wrote:
> Hello,
> It looks like a recent patch causes VA-API H.264 encode to stop working and 
> an assertion to be thrown.  I ran a git bisect and narrowed it down to the 
> following commit:
> 32a618a948c20f18db102d0b0976790222a57105 is the first bad commit
> commit 32a618a948c20f18db102d0b0976790222a57105
> Author: Mark Thompson <s...@jkqxz.net>
> Date:   Wed Oct 18 19:46:53 2017 +0100
>     vaapi_h264: Do not use deprecated header type
>     SEI headers should be inserted as generic raw data (the old specific
>     type has been deprecated in libva2).
> When run with the above patch, I get the following output:
> [h264_vaapi @ 0x37d0a20] Warning: some packed headers are not supported (want 
> 0xd, got 0xb).
> [h264_vaapi @ 0x37d0a20] The encode compression level option is not supported 
> with this VAAPI version.
> ffmpeg: i965_drv_video.c:352: va_enc_packed_type_to_idx: Assertion `0' failed.
> Here’s the vainfo output which provides the version info for the driver, 
> va-api version, etc.  This is on a Haswell system running Centos 7.
> libva info: VA-API version 0.34.0
> libva info: va_getDriverName() returns 0
> libva info: Trying to open /usr/lib64/dri/i965_drv_video.so
> libva info: Found init function __vaDriverInit_0_34
> libva info: va_openDriver() returns 0
> vainfo: VA-API version: 0.34 (libva 1.2.1)
> vainfo: Driver version: Intel i965 driver - 1.2.2

Upgrading to a version less than four years old might be a plan - I admit we do 
notionally support that version because of old RHEL/CentOS, but it is not well 
tested (as you are finding).

> I’m using the following command line for testing:
> ./ffmpeg -y -vaapi_device /dev/dri/card0 -i /home/devin/inputfile.ts -vf 
> 'format=nv12,hwupload' -c:v h264_vaapi out.mp4
> Any suggestions that could be offered would be greatly appreciated.  Likewise 
> please let me know if there is any other information I can provide that would 
> assist in getting this resolved.

Try this?  (Not tested, hardware which can run a version that old isn't 
immediately to hand.)

--- a/libavcodec/vaapi_encode_h264.c
+++ b/libavcodec/vaapi_encode_h264.c
@@ -261,7 +261,8 @@ static int 
vaapi_encode_h264_write_extra_header(AVCodecContext *avctx,
         return 0;
-    } else if (priv->sei_cbr_workaround_needed) {
+    } else if (priv->sei_cbr_workaround_needed &&
+               ctx->va_packed_headers & VA_ENC_PACKED_HEADER_SLICE) {
         // Insert a zero-length header using the old SEI type.  This is
         // required to avoid triggering broken behaviour on Intel platforms
         // in CBR mode where an invalid SEI message is generated by the

(Probably wants a comment pointing at the driver code to explain why that 
condition, too.)

- Mark
ffmpeg-devel mailing list

Reply via email to