Constant Quality vs Average Bit Rate

General questions or discussion about HandBrake, Video and/or audio transcoding, trends etc.
rollin_eng
Veteran User
Posts: 4840
Joined: Wed May 04, 2011 11:06 pm

Re: Constant Quality vs Average Bit Rate

Post by rollin_eng »

Obviously you knew that these videos use big bitrates so you and so you were able to use this to get your desired results.

I think the OP is after a setting to use on all encodes, also you have a fairly high bitrate and vbv setting which give you some wiggle room for your bitrates. In this case the target of around 1000kbps doesn’t leave much room for bitrate fluctuations.

I guess the OP should give it a try and hopefully report back.
Deleted User 11865

Re: Constant Quality vs Average Bit Rate

Post by Deleted User 11865 »

Wasn't he trying to get a minimum bitrate of 1,000 (with no limitation on the maximum)? I must admit I didn't follow this thread very closely, only saw the request for a minimum bitrate.
HandTux
Posts: 13
Joined: Fri Feb 19, 2021 12:48 pm

Re: Constant Quality vs Average Bit Rate

Post by HandTux »

Thanks for all of your replies!
I guess the OP should give it a try and hopefully report back.
I will do both. Well, actually I already tried, now only the reporting is left to do.

My initial idea was to get a small filesize with a maximum quality. I was a little influenced by an x265 encoding (1280 x 528) of an 2 h 40 min movie that was only 714 MB an looked amazing for this file size (had seen this somewhere else). Of course it might be that the scenes of this movie were exceptionally well suited to keep the file size small. Till now I never managed to get a comparable quality at such a tiny file size, and I'm still trying ... but I think I've gotten better.

So for now I tried to re-encode a 2 h 45 min movie (FullHD, approx. 10 Gb) and shrink it to 1280x544, using x265. Most of my setting are identical to the settings provided in the logfile. So here is some of the outcomes:

x265, at medium recording speed, with 2x 160 kbps AAC:

Constant Bitrate 1000: 1606 MB => complex scenes could be better
Constant Bitrate 1200: 1837 MB => only a little improvement
RF 28: 1587 MB => annoying artefacts in some scenes
RF 25 vbv-bufsize=1500:vbv-maxrate=1500: 1742 MB => looks pretty good
RF 25 vbv-bufsize=1600:vbv-maxrate=1600: 2172 MB => not much better, but larger

And actually at the moment the best compromise between file size and quality till now was achieved with RF 25 and vbv-bufsize & vbv-maxrate 1500.

I'll probably keep on experimenting with settings and try to find a default that best suits my needs, but I guess there won't be a perfect default setting for every movie.
Deleted User 13735

Re: Constant Quality vs Average Bit Rate

Post by Deleted User 13735 »

The only thing I would produce at those bitrates are talking heads with static background.
rollin_eng
Veteran User
Posts: 4840
Joined: Wed May 04, 2011 11:06 pm

Re: Constant Quality vs Average Bit Rate

Post by rollin_eng »

Although we are now on x265 which does much better at lower bitrates.
HandTux
Posts: 13
Joined: Fri Feb 19, 2021 12:48 pm

Re: Constant Quality vs Average Bit Rate

Post by HandTux »

I've kept on fiddling around with this and finally found a solution that is probably as close to my initial idea as possible, or even better :D

Initially I thought I could limit the minimum bitrate - to get a high quality in less complex images - and use a moderate RF value to limit file size. With the information you gave me, I see that there is no such setting with x264/x265. And it's probably also not the best idea. My latest try is composed of three elements, to get a small file with a decent quality:

1. Set an RF value that is not to low => this is better than a minimum bitrate, as I actually want a minimum quality.
2. Limit the bit rate at the upper end through vbv-bufsize & vbv-maxrate.
3. Allow to go above this bitrate if the quality would drop to much at this bitrate through crf-max.

I've tried this with several encodings. I used the same file as above: 2 h 45 min (FullHD, approx 10 Gb), x264 => HD 1280x544, 2x 160 kbps AAC, x265.
  • RF:28
    => easiest setting in GUI
    => 1588 Mb
  • Bitrate: 1200 kbps one pass
    => also easy setting in GUI
    => 1838 Mb
  • RF:25; vbv-bufsize=1500:vbv-maxrate=1500
    => cut off at 1500 kbps no matter the scene
    => 1742 Mb
  • RF:25; vbv-bufsize=1600:vbv-maxrate=1600
    => cut off at 1600 kbps no matter the scene
    => 2172 Mb
  • RF:25; vbv-bufsize=3000:vbv-maxrate=1500
    => cut off at 1600 kbps no matter the scene
    => 1762 Mb
  • RF: 25; vbv-bufsize=3000:vbv-maxrate=1500:crf-max=28
    => cut off at 1500 kbps but allows more if quality would drop below 28
    => 1801 Mb
  • RF: 25; vbv-bufsize=3000:vbv-maxrate=1300:crf-max=28
    => cut off at 1300 kbps but allows more if quality would drop below 28
    => 1725 Mb
  • RF: 25; vbv-bufsize=3000:vbv-maxrate=1100:crf-max=28
    => cut off at 1100 kbps but allows more if quality would drop below 28
    => 1648 Mb
The last three settings are what I've been looking for. I've got the quality I wanted at less complex scenes while limiting the bitrate for very quick scene changes and more complex frames. Still for very complex frames the quality won't drop below 28, even if this means that the bitrate has to be higher than what is specified by vbv-maxrate.
Deleted User 13735

Re: Constant Quality vs Average Bit Rate

Post by Deleted User 13735 »

What are your intended uses for such small files?
Storage is cheap, streaming bandwidth is plentiful, quality seems not to be a concern to you after all, is it a really a hobbyist experiment?
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: Constant Quality vs Average Bit Rate

Post by mduell »

Maybe you want to use Don Melton's Video Transcoding tools... they use a mix of CRF, VBV, and min QP to limit both high bitrate excursions as well as low quality excursions.

https://github.com/donmelton/video_transcoding
rollin_eng
Veteran User
Posts: 4840
Joined: Wed May 04, 2011 11:06 pm

Re: Constant Quality vs Average Bit Rate

Post by rollin_eng »

Do any of these settings effect the speed of the encode?
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: Constant Quality vs Average Bit Rate

Post by mduell »

Not significantly, that's still driven by the speed preset.
HandTux
Posts: 13
Joined: Fri Feb 19, 2021 12:48 pm

Re: Constant Quality vs Average Bit Rate

Post by HandTux »

musicvid wrote: Sun Mar 07, 2021 9:09 pm What are your intended uses for such small files?
Storage is cheap, streaming bandwidth is plentiful, quality seems not to be a concern to you after all, is it a really a hobbyist experiment?
Really just a hobby. No streaming here, only for my private use. Like I said I've seen files below 1 Gb that looked amazing (at 1280 width) and would like to achieve a similar quality. I feel like I've gotten a little closer to that. We can talk about storage of larger files when normal height 2.5" disks have reached sizes of 5 Tb ;)
HandTux
Posts: 13
Joined: Fri Feb 19, 2021 12:48 pm

Re: Constant Quality vs Average Bit Rate

Post by HandTux »

Even ignoring the high price tag, SSDs are not exactly the best backup medium. Especially the linked Samsung disk uses QLC flash storage, meaning that 4 bits per cell have to be stored. Each cell must distinguish 2**4 = 16 different charge levels. QLC SSDs show the highest wear among all SSDs. Last numbers I recall are 300 write cycles per cell. Also flash storage media tend to forget their content, if stored without power for a longer period. I already experienced this with an USB stick that had forgotten parts of its content after 3-4 years of not being used. Today I still consider hard disks to be the better long term storage medium. For a large gaming library the above Samsung 8 TB SSD might be great, but long term storage - not so much. I'm rather looking forward for heat assisted magnetic recording (HAMR) hard disks in the coming years.
rollin_eng
Veteran User
Posts: 4840
Joined: Wed May 04, 2011 11:06 pm

Re: Constant Quality vs Average Bit Rate

Post by rollin_eng »

Unfortunately for you I think that 2.5” non SSD drives are a dead end technology. I imagine that SSDs will kill the demand for them as well as physical limitations of squeezing more data into the size. But you never know.
HandTux
Posts: 13
Joined: Fri Feb 19, 2021 12:48 pm

Re: Constant Quality vs Average Bit Rate

Post by HandTux »

You might be right, still I'm not that pessimistic about 2,5" HDDs. It seems that new momentum is coming into HDD development, with Seagate announcing 100 TB drives in 2030. Admittedly manufactures have to deliver, not just announce, but doubling today's capacities would already be a thing. I hope I'm allowed to link this resource (please delete if not):
https://www.tomshardware.com/news/seaga ... admap-2021
Considering that nowadays you can find more 2,5" USB HDDs than 3,5" USB HDDs, there is still demand for those drives.
rollin_eng
Veteran User
Posts: 4840
Joined: Wed May 04, 2011 11:06 pm

Re: Constant Quality vs Average Bit Rate

Post by rollin_eng »

I have no doubt that 3.5” spinning drives will exist for a long time as size is always needed.

I would guess that all USB 2.5” HDDs will eventually just be SSDs.
Post Reply