[FFmpeg-devel] [PATCH v2 01/11] vaapi_encode: Support more RC modes

Mark Thompson sw at jkqxz.net
Mon Feb 4 11:26:15 EET 2019


On 28/01/2019 04:23, Eoff, Ullysses A wrote:
>> -----Original Message-----
>> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf Of Mark Thompson
>> Sent: Sunday, January 27, 2019 3:47 PM
>> To: ffmpeg-devel at ffmpeg.org
>> Subject: [FFmpeg-devel] [PATCH v2 01/11] vaapi_encode: Support more RC modes
>>
>> Allow setting the mode explicitly, and try to make a sensible choice
>> given the available parameters if not.
>> ---
>>  doc/encoders.texi         |  24 +++
>>  libavcodec/vaapi_encode.c | 370 +++++++++++++++++++++++++++-----------
>>  libavcodec/vaapi_encode.h |  65 +++++++
>>  3 files changed, 351 insertions(+), 108 deletions(-)
>>
>> ...
>>      if (rc_attr.value == VA_ATTRIB_NOT_SUPPORTED) {
>>          av_log(avctx, AV_LOG_VERBOSE, "Driver does not report any "
>> -               "supported rate control modes: assuming constant-quality.\n");
>> -        ctx->va_rc_mode = VA_RC_CQP;
>> -        return 0;
>> ...
> 
> With this patch series, mjpeg_vaapi encoder breaks with iHD driver:
> 
> LIBVA_DRIVER_NAME=iHD ffmpeg -hwaccel vaapi \
>   -vaapi_device /dev/dri/renderD128 -v debug \
>   -f rawvideo -pix_fmt yuv420p -s:v 1920x1080 \
>   -i input.yuv -vf 'format=nv12,hwupload' -c:v mjpeg_vaapi \
>   -global_quality 100 -vframes 10 -y output.mjpg
> 
> <snip>
> [AVHWDeviceContext @ 0x193c580] Opened VA display via DRM device /dev/dri/renderD128.
> [AVHWDeviceContext @ 0x193c580] libva: VA-API version 1.4.0
> [AVHWDeviceContext @ 0x193c580] libva: va_getDriverName() returns 0
> [AVHWDeviceContext @ 0x193c580] libva: User requested driver 'iHD'
> [AVHWDeviceContext @ 0x193c580] libva: Trying to open /home/uaeoff/Work/workspace/media/install/lib/dri/iHD_drv_video.so
> [AVHWDeviceContext @ 0x193c580] libva: Found init function __vaDriverInit_1_4
> [AVHWDeviceContext @ 0x193c580] libva: va_openDriver() returns 0
> [AVHWDeviceContext @ 0x193c580] Initialised VAAPI connection: version 1.4
> <snip>
> [mjpeg_vaapi @ 0x19847c0] Input surface format is nv12.
> [mjpeg_vaapi @ 0x19847c0] Using VAAPI profile VAProfileJPEGBaseline (12).
> [mjpeg_vaapi @ 0x19847c0] Using VAAPI entrypoint VAEntrypointEncPicture (7).
> [mjpeg_vaapi @ 0x19847c0] Using VAAPI render target format YUV420 (0x1).
> [mjpeg_vaapi @ 0x19847c0] Driver does not report any supported rate control modes: assuming CQP only.
> [mjpeg_vaapi @ 0x19847c0] RC mode: CQP.
> [mjpeg_vaapi @ 0x19847c0] RC quality: 100.
> [mjpeg_vaapi @ 0x19847c0] RC framerate (CFR mode): 25/1 (25.00 fps).
> [mjpeg_vaapi @ 0x19847c0] Using intra frames only.
> [mjpeg_vaapi @ 0x19847c0] All wanted packed headers available (wanted 0x10, found 0x10).
> [mjpeg_vaapi @ 0x19847c0] Failed to create encode pipeline configuration: 10 (attribute not supported).
> Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
> [AVIOContext @ 0x1987000] Statistics: 0 seeks, 0 writeouts
> [AVIOContext @ 0x19802c0] Statistics: 3110400 bytes read, 0 seeks
> Conversion failed!
> 
> ... it works fine on i965 driver.

Right, the specific workaround to not set any options on drivers which report no supported RC modes (highlighted above) needs to be carried forward to this.  Added.

Thank you for testing!

- Mark


More information about the ffmpeg-devel mailing list