Opened 6 months ago

Last modified 6 months ago

#8119 reopened enhancement

mpeg2_vaapi encoder "QP" parameter for CQP

Reported by: ahakon Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: vaapi_encode_mpeg2, cqp
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

When using the CQP Rate Control (-c:v mpeg2_vaapi -rc_mode CQP)
the current implementation only accepts the global_quality to configure it. This value is set using the "-q:v" option, but this value isn't in the common range 0-31 (in fact, 0.09 corresponds to 10, 0.1 to 11, etc.).

However, in the H.264 VAAPI encoder (h264_vaapi) the explicit parameter "QP" exists. And this value sets the GENERIC VAAPI ENCODER value of "explicit_qp". See:

https://github.com/FFmpeg/FFmpeg/blob/f30fb5ef626140d6e286a22e4f5ca7e7f5b97c67/libavcodec/vaapi_encode_h264.c#L1258
https://github.com/FFmpeg/FFmpeg/blob/f30fb5ef626140d6e286a22e4f5ca7e7f5b97c67/libavcodec/vaapi_encode_h264.c#L1236

So, only adding this "-qp" parameter to the MPEG2 VAAPI ENCODER, then it will enable the option to use the common 0-31 range with this encoder. In fact, a very small of new source lines are required. Just copy&paste!

Regards.

Change History (2)

comment:1 follow-up: Changed 6 months ago by jkqxz

  • Resolution set to invalid
  • Status changed from new to closed

-global_quality:v

comment:2 in reply to: ↑ 1 Changed 6 months ago by ahakon

  • Resolution invalid deleted
  • Status changed from closed to reopened

Replying to jkqxz:

-global_quality:v

Hi,

I writed it in my report: -global_quality:v not uses the common range 1-31.

And for this reason h264_vaapi and others have -qp. Futhermore, the GENERIC implementation of the VAAPI encoder has the explicit_qp variable. And all vaapi encoders, EXCEPT the mpeg2 uses it. The request it's to copy&paste the four lines of code from vaapi_encode_h264.c to vaapi_encode_mpeg2.c

So I reopen the ticket as it's valid.
Regards.

Note: See TracTickets for help on using tickets.