[FFmpeg-trac] #7650(avcodec:new): FFmpeg MPEG-2 encode fails to "invalid RC mode" when iHD driver is used through VA-API instead of QSV

FFmpeg trac at avcodec.org
Wed Jan 2 14:04:49 EET 2019


#7650: FFmpeg MPEG-2 encode fails to "invalid RC mode" when iHD driver is used
through VA-API instead of QSV
---------------------------------+---------------------------------------
             Reporter:  eero-t   |                     Type:  defect
               Status:  new      |                 Priority:  normal
            Component:  avcodec  |                  Version:  unspecified
             Keywords:           |               Blocked By:
             Blocking:           |  Reproduced by developer:  0
Analyzed by developer:  0        |
---------------------------------+---------------------------------------
 Setup:
 * Ubuntu 18.04
 * Any HW with MPEG-2 HW acceleration support enabled by intel-driver
 (Intel Skylake, Kabylake, Coffeelake...)
 * Latest FFmpeg, MediaSDK, libva, intel-driver and gmmlib built from
 sources at Github
 * drm-git kernel (e.g. v4.19 or v4.20)


 Bug can be reproduced by any FFmpeg MPEG-2 encoding with VA-API.  For
 example:
 {{{
 ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128
 -hwaccel_output_format vaapi -i 720x480p_30.00_4mb_h264_cabac.264 -c:v
 mpeg2_vaapi -b:v 2M -compression_level 4 -y output.mpg
 ...
 Input #0, h264, from '720x480p_30.00_4mb_h264_cabac.264':
   Duration: N/A, bitrate: N/A
     Stream #0:0: Video: h264 (High), yuv420p(tv, smpte170m, progressive),
 720x480 [SAR 10:11 DAR 15:11], 30 fps, 30 tbr, 1200k tbn, 60 tbc
 Stream mapping:
   Stream #0:0 -> #0:0 (h264 (native) -> mpeg2video (mpeg2_vaapi))
 Press [q] to stop, [?] for help
 [mpeg2_vaapi @ 0x564a286e6100] Driver does not support some wanted packed
 headers (wanted 0x3, found 0x10).
 Assertion 0 && "Invalid RC mode." failed at
 src/libavcodec/vaapi_encode_mpeg2.c:545
 }}}

 Exactly same use-case works HW accelerated when done:
 * through FFmpeg QSV API, or
 * using MediaSDK sample transcode application

 Looking at the FFmpeg source code, it seems to accept only VA_RC_CQP mode:
 https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/vaapi_encode_mpeg2.c#L523

 And mode is something set before FFmpeg vaapi_encode_mpeg2_configure() is
 called, as it's not set in ff_cbs_init():
 https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/cbs.c#L74

--
Ticket URL: <https://trac.ffmpeg.org/ticket/7650>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list