[QSV] - VBR Feature Request / QP Max Bitrate Limit

General questions or discussion about HandBrake, Video and/or audio transcoding, trends etc.
Post Reply
JustEncode
Posts: 14
Joined: Wed Aug 11, 2021 9:59 am

[QSV] - VBR Feature Request / QP Max Bitrate Limit

Post by JustEncode »

Description of problem or question:

Hello developers,
I have a question, whether it would be possible to add a certain function. At the moment I use QSV because I find the topic very exciting, but the "QP" method is useless for my purposes because there is no option to define the maximum bit rate. The problem is that there are scenes in films or series in which the bit rate increases to 100Mbits or even 300Mbits (example HBO intro, where the logo is faded in with the oldschool noise). My best option so far is the VBR method, but I always have to appreciate it.

Now to my question. Is there a possibility, if necessary, of having the value determined by yourself? I thought that you might enter a percentage value, such as 60%. When you start the encode, the video bit rate is somehow analyzed and displayed in the log. Wouldn't it be possible afterwards to dynamically enter 60% of the value of the VBR value with a small method?

The background is that you have, for example, a series with 13 episodes, but the average bit rate is different everywhere. It is possible that sequence 1 is 8000 kbits and sequence 2 is only 3500 kbits. If I now enter 5000 kbits as the value for all episodes, that's unfortunately stupid because some episodes are larger than the source in the end.

As I said before, the QP method would be perfect, but it's kind of buggy. 80% of the film or series works as it should, but the outliers cause serious problems, so that playback is no longer possible or the entire video even breaks off and my player gets stuck.

Therefore two options would make sense. Either to have the average bit rate calculated dynamically with percent, so that the output file is never larger, or with the QP method, somehow build in a possibility to limit the maximum bit rate.

Best Regards
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: [QSV] - VBR Feature Request / QP Max Bitrate Limit

Post by mduell »

A percentage with pre-analysis of... whatever... isn't going to happen.

vbv limits may be possible if the encoder supports them.
JustEncode
Posts: 14
Joined: Wed Aug 11, 2021 9:59 am

Re: [QSV] - VBR Feature Request / QP Max Bitrate Limit

Post by JustEncode »

Perhaps a developer can give feedback on whether a limitation of the maximum bitrate is possible with the QP method or explain how these high bit rates arise in certain scenes or how i can avoid them.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: [QSV] - VBR Feature Request / QP Max Bitrate Limit

Post by JohnAStebbins »

As mduell pointed out, the best way to control bitrate spikes when using a quality metric for encoding is through vbv-maxrate and vbv-bufsize settings. These settings are specifically designed for this purpose. QP (like RF) will not limit bitrate. QP is a quality metric. The encoder will apply whatever bitrate is necessary to achieve that metric unless some other setting (like VBV) prevents it.

Encoder "level" can also be used to indirectly set VBV values. For h.264 a table of the VBV values applied for a give level can be found here https://help.encoding.com/knowledge-bas ... 64-levels/

For x264, documentation of these settings can be found here http://www.chaneru.com/Roku/HLS/X264_Settings.htm
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: [QSV] - VBR Feature Request / QP Max Bitrate Limit

Post by mduell »

JohnAStebbins wrote: Tue Oct 19, 2021 1:58 pmFor x264, documentation of these settings can be found here http://www.chaneru.com/Roku/HLS/X264_Settings.htm
OP is using QSV, not x264.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: [QSV] - VBR Feature Request / QP Max Bitrate Limit

Post by JohnAStebbins »

mduell wrote: Tue Oct 19, 2021 2:09 pm OP is using QSV, not x264.
Yes, but I don't believe QSV supports separate vbv settings (I could be wrong). So I offered the information as an alternative to QSV.
Deleted User 11865

Re: [QSV] - VBR Feature Request / QP Max Bitrate Limit

Post by Deleted User 11865 »

QSV does support VBV, but sadly not in combination with CQP nor ICQ (QSV's CRF-like rate control), unless it changed recently.

https://handbrake.fr/docs/en/latest/tec ... o-qsv.html

I don't think x264/x265 support CQP+VBV either, but CRF+VBV is indeed an option there.
JustEncode
Posts: 14
Joined: Wed Aug 11, 2021 9:59 am

Re: [QSV] - VBR Feature Request / QP Max Bitrate Limit

Post by JustEncode »

I think it's a shame but also a very big problem at the same time. That's why I asked for a "method" that can pass the bitrate as an average percentage as a parameter in the GUI. If there is no other option, ICQ is unfortunately not an option for me if the bitrate is sometimes 10 times greater than in the original file. I mean, is this a mistake in the analysis or how can this happen?
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: [QSV] - VBR Feature Request / QP Max Bitrate Limit

Post by JohnAStebbins »

JustEncode wrote: Wed Oct 20, 2021 2:20 pm I mean, is this a mistake in the analysis or how can this happen?
The compression algorithm knows nothing about the bitrate or quality of the original file. In fact, the original file is uncompressed before being passed to the encoder. The encoder sees only raw uncompressed frames. Strongly compressed frames often have compression artefacts that do not re-compress well. I.e. the encoder will try to preserve those artefacts. Compression artefacts do not conform well to the models used by the encoder that try to predict what a more natural scene would look like and how it might evolve over a sequence of frames. So, if you are using a higher quality metric than the original file was encoded with, the encoder is going to be preserving more detail than was actually present in the compressed video.
Post Reply