Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 8th August 2022, 09:32   #1  |  Link
takla
Registered User
 
Join Date: May 2018
Posts: 181
A list for the maximum allowed vbv-bufsize & vbv-maxrate per level

I forced ffmpeg to show me some values (by specifying way too high values it showed me the maximum)

Here you go, if anyone else needs this.
https://docs.google.com/spreadsheets...z3mcwd/pubhtml

Any reason why I shouldn't always use the highest allowed vbv-bufsize? After all, if a device supports a given level, it would also need to support the maximum possible bufsize.

The reason why I do this in the first place is, I measured the difference in VMAF, and using the highest allowed vbv-bufsize always had better scores.

In my tests (1920x1080p60 8000CBR preset medium), the worst frames improved by up to 5.5% at the cost of 1.3% encoding speed.
That was a higher improvement then going from preset medium to preset slow.

Medium: Average: 87.422148 Worst: 54.726831
Slow: Average: 87.610072 Worst: 54.896813
Medium+maximum vbv-bufsize: Average: 87.828082 Worst: 57.739257

Last edited by takla; 11th August 2022 at 03:37.
takla is offline   Reply With Quote
Old 9th August 2022, 16:49   #2  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,255
What's wrong with the values from
https://en.wikipedia.org/wiki/Advanc..._Coding#Levels
https://en.wikipedia.org/wiki/Advanc...ture_buffering
?
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 9th August 2022, 17:43   #3  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,738
Quote:
Originally Posted by takla View Post
Any reason why I shouldn't always use the highest allowed vbv-bufsize? After all, if a device supports a given level, it would also need to support the maximum possible bufsize. The reason why I do this in the first place is, I measured the difference in VMAF, and using the highest allowed vbv-bufsize always came out ahead.
Using the max allowed vbv-bufsize for Profile @ Level is a good default.

There are a few reasons why someone would lower it
  1. Reducing it by a bit to give some headroom to make SURE it is VBV compliant.
  2. Making an adaptive streaming multiple bitrate ladder and wanting to get a good distribution of fragment sizes per segment.
  3. Encoding for real-time playback over potentially slower network conditions.
  4. Targeting a specific platform with different limits. For example, Blu-ray supports H.264 up to 40 Mbps.
  5. Content has some very difficult to encode sections that will always consume the max bitrate, starving other, easier parts of the title and reducing the overall quality of experience.

But for local file playback, yeah using the max values offers the most flexibility to the encoder to redistribute bits to minimize quality fluctuations.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 10th August 2022, 01:18   #4  |  Link
takla
Registered User
 
Join Date: May 2018
Posts: 181
Quote:
Originally Posted by Selur View Post
None of those values are for Profile: High

Quote:
Originally Posted by benwaggoner View Post
Using the max allowed vbv-bufsize for Profile @ Level is a good default.

There are a few reasons why someone would lower it
  1. Reducing it by a bit to give some headroom to make SURE it is VBV compliant.
  2. Making an adaptive streaming multiple bitrate ladder and wanting to get a good distribution of fragment sizes per segment.
  3. Encoding for real-time playback over potentially slower network conditions.
  4. Targeting a specific platform with different limits. For example, Blu-ray supports H.264 up to 40 Mbps.
  5. Content has some very difficult to encode sections that will always consume the max bitrate, starving other, easier parts of the title and reducing the overall quality of experience.

But for local file playback, yeah using the max values offers the most flexibility to the encoder to redistribute bits to minimize quality fluctuations.
All good reasons. Thanks for sharing👍
My use case here was real-time streaming. In this case, I don't think device compatibility will be an issue with Level 4.2 in 2022😉

Last edited by takla; 10th August 2022 at 01:37.
takla is offline   Reply With Quote
Old 10th August 2022, 02:19   #5  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,255
Quote:
None of those values are for Profile: High
iirc. for
* High, maxBitrates should be multiplied by 1.25
* High10, maxBitrates should be multiplied by 3
* High422/High444, maxBitrates should be multiplied by 4
and Buffers should be multiplied by 3
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 10th August 2022, 14:16   #6  |  Link
takla
Registered User
 
Join Date: May 2018
Posts: 181
Quote:
Originally Posted by Selur View Post
iirc. for
* High, maxBitrates should be multiplied by 1.25
* High10, maxBitrates should be multiplied by 3
* High422/High444, maxBitrates should be multiplied by 4
and Buffers should be multiplied by 3
But that already fails to be true:

The maximum allowed bitrate with Level 4.2 for Constrained Baseline, Baseline, Extended and Main is 50000 and 50000*1.25 is 62500 or 50000*3 is 150000, when in reality, the maximum vbv-bufsize for profile=high is 78125.

You are just making numbers up. I already added all real max values for relevant levels as a link to the OP, which you seems to have missed.
takla is offline   Reply With Quote
Old 10th August 2022, 16:50   #7  |  Link
rwill
Registered User
 
Join Date: Dec 2013
Posts: 341
Quote:
Originally Posted by takla View Post
But that already fails to be true:

The maximum allowed bitrate with Level 4.2 for Constrained Baseline, Baseline, Extended and Main is 50000 and 50000*1.25 is 62500 or 50000*3 is 150000, when in reality, the maximum vbv-bufsize for profile=high is 78125.

You are just making numbers up. I already added all real max values for relevant levels as a link to the OP, which you seems to have missed.
You are mixing bitrate and CPB size. If you don't trust Wikipedia at least be pro enough and go to www.itu.int, download the H.264 standard and run the numbers yourself.

Last edited by rwill; 10th August 2022 at 17:00.
rwill is offline   Reply With Quote
Old 10th August 2022, 16:53   #8  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,255
I don't think I made them up (I collected that data 10+years ago), but to be sure I did a quick search.
According to the specification T-REC-H.264-200503-S (https://www.itu.int/rec/T-REC-H.264-200503-S; document was superseded but the restrictions stayed the same afaik.)
A.3.1 Table A-1 for limits for the Baseline, Main, and Extended profiles
A.3.3 Table A-2 for the "Specification of cpbBrVclFactor and cpbBrNalFactor"
I should be correct, https://forum.doom9.org/showthread.p...09#post1215709 does seem to agree with me too.
Quote:
Profile | cpbBrVclFactor | cpbBrNalFactor
High | 1250 | 1500
High 10 | 3000 | 3600
High 10 Intra | 3000 | 3600
High 4:2:2 | 4000 | 4800
High 4:2:2 Intra | 4000 | 4800
High 4:4:4 Predictive | 4000 | 4800
High 4:4:4 Intra | 4000 | 4800
CAVLC 4:4:4 Inta | 4000 | 4800
=> if you find a specification that specified different cpbBrVclFactor and cpbBrNalFactor please let me know and please share a link.

Cu Selur

Ps.: but maybe I understood you wrong for what you are looking for and you are looking for something totally different ¯\_(ツ)_/¯
__________________
Hybrid here in the forum, homepage

Last edited by Selur; 10th August 2022 at 16:57.
Selur is offline   Reply With Quote
Old 11th August 2022, 03:19   #9  |  Link
takla
Registered User
 
Join Date: May 2018
Posts: 181
If you use ffmpeg, and specify a vbv-bufsize, vbv-maxrate & bitrate of something ridiculous like 800k, as well as a profile and level, it will tell you the correct max values for bitrate and buffer. All of these values can be found in the google sheet link in the OP. I'm no longer looking for these values. Thanks anyways.

Last edited by takla; 11th August 2022 at 03:27.
takla is offline   Reply With Quote
Old 11th August 2022, 08:41   #10  |  Link
MasterNobody
Registered User
 
Join Date: Jul 2007
Posts: 552
Why don't you want to just open the H.264 specs?
And just multiply by 1.25 for the High profile.

MasterNobody is offline   Reply With Quote
Old 11th August 2022, 10:51   #11  |  Link
takla
Registered User
 
Join Date: May 2018
Posts: 181
Quote:
Originally Posted by MasterNobody View Post
Why don't you want to just open the H.264 specs?
And just multiply by 1.25 for the High profile.

I actually did try to find it in pdf.
1) There are dozens of pages labeled as "levels and profiles".
2) How should I have known to multiply those values by 1.25 (Why don't they show the values directly in the docs?)
takla is offline   Reply With Quote
Old 11th August 2022, 13:46   #12  |  Link
excellentswordfight
Lost my old account :(
 
Join Date: Jul 2017
Posts: 322
Quote:
Originally Posted by takla View Post
I actually did try to find it in pdf.
1) There are dozens of pages labeled as "levels and profiles".
2) How should I have known to multiply those values by 1.25 (Why don't they show the values directly in the docs?)
There are different sections for lower profiles (i.e. Baseline, Constrained Baseline, Main, or Extended) and higher ( High, Progressive High, Constrained High, High 10, Progressive High 10, High 4:2:2, High 4:4:4 Predictive, High 10 Intra, High 4:2:2 Intra, High 4:4:4 Intra, or CAVLC 4:4:4 Intra). If you look at A.3.3 Profile-specific level limits you will find this:

Quote:
In bitstreams conforming to the High, Progressive High, Constrained High, High 10, Progressive High 10,
High 4:2:2, High 4:4:4 Predictive, High 10 Intra, High 4:2:2 Intra, High 4:4:4 Intra, or CAVLC 4:4:4 Intra
profiles, for the VCL HRD parameters, BitRate[ SchedSelIdx ] <= cpbBrVclFactor * MaxBR and
CpbSize[ SchedSelIdx ] <= cpbBrVclFactor * MaxCPB for at least one value of SchedSelIdx, where
cpbBrVclFactor is specified in Table A-2 and BitRate[ SchedSelIdx ] and CpbSize[ SchedSelIdx ] are given as
follows
Which are refering to the values in Table A-2 which Selur posted.

But I dont see anything about 3x for buffsize, shoudlnt it just be MaxCPB table and x 1,25 there as well?

Last edited by excellentswordfight; 11th August 2022 at 14:39.
excellentswordfight is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:52.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.