Opened 5 years ago

Last modified 3 years ago

#8119 reopened enhancement

mpeg2_vaapi encoder "QP" parameter for CQP

Reported by: Andreas Håkon Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: vaapi
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


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:

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!


Change History (5)

comment:1 by jkqxz, 5 years ago

Resolution: invalid
Status: newclosed


in reply to:  1 comment:2 by Andreas Håkon, 5 years ago

Resolution: invalid
Status: closedreopened

Replying to jkqxz:



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.

comment:3 by wenbin,chen, 3 years ago

According to here
you need to use "-i_qfactor","-i_qoffset","-b_qfactor" and "-b_qoffset" to set qp for I and B frame.

And according to here
you need to use global quality to set qp for P frame.


comment:4 by wenbin,chen, 3 years ago

Cc: added

comment:5 by Carl Eugen Hoyos, 3 years ago

Keywords: vaapi added; vaapi_encode_mpeg2 cqp removed
Note: See TracTickets for help on using tickets.