PDA

View Full Version : r frames limitations


juGGaKNot
22nd April 2009, 18:40
Hello

We have to make a small ref calculator for a tutorial/gui and i have some questions :

1 : Is the maximum ref = 12288 * 1024 / ( width * height * 1.5) formula good for all levels or only 4.0 ?

2 : Is my math good :

640x480x1.5 = 460800
800x600x1.5 = 720000
960x540x1.5 = 777600
960x600x1.5 = 864000
1024x576x1.5 = 884736
1024x640x1.5 = 983040
1280x720x1.5 = 1382400
1280x800x1.5 = 1536000
1440x1080x1.5 = 2332800
1920x1080x1.5 = 3110400

maximum ref = 12582912 / ( 460800 ) = 16
maximum ref = 12582912 / ( 720000 ) = 16
maximum ref = 12582912 / ( 777600 ) = 16
maximum ref = 12582912 / ( 864000 ) = 14
maximum ref = 12582912 / ( 884736 ) = 14
maximum ref = 12582912 / ( 983040 ) = 12
maximum ref = 12582912 / ( 1382400 ) = 9
maximum ref = 12582912 / ( 1536000 ) = 8
maximum ref = 12582912 / ( 2332800 ) = 5
maximum ref = 12582912 / ( 3110400 ) = 4

640x480 = 16 refs
800x600 = 16 refs
960x540 = 16 refs
960x600 = 14 refs
1024x576 = 14 refs
1024x640 = 12 refs
1280x720 = 9 refs
1280x800 = 8 refs
1440x1080 = 5 refs
1920x1080 = 4 refs

I tested the formula by hand and now i see that custom resolutions might need more or less refs so we decided to make a small app similar to the Uncompressed filesize calculator ( this is the beta version ) (http://www.mediafire.com/download.php?kzy5kyi0zk2) to help the users.

THNX in advance.

Cheers.

LoRd_MuldeR
23rd April 2009, 01:28
The maximum number of reference frames depends on the "Max decoded picture buffer size" property.

And that property is defined per Profile. For 4.0 and 4.1 it is defined as 12288*1024 bytes, but other Profiles have other MaxDPB values.

See the table in Annex A of the H.264 specs (page 283) for details:
T-REC-H[1].264-200711-I!!PDF-E.pdf (http://www.neuron2.net/library/avc/T-REC-H%5b1%5d.264-200711-I!!PDF-E.pdf)

juGGaKNot
23rd April 2009, 22:19
The maximum number of reference frames depends on the "Max decoded picture buffer size" property.

And that property is defined per Profile. For 4.0 and 4.1 it is defined as 12288*1024 bytes, but other Profiles have other MaxDPB values.

See the table in Annex A of the H.264 specs (page 283) for details:
T-REC-H[1].264-200711-I!!PDF-E.pdf (http://www.neuron2.net/library/avc/T-REC-H%5b1%5d.264-200711-I!!PDF-E.pdf)

K, thnx, will read it.

LE : so

Level 1 = 148.5 * 1024 / ( width * height * 1.5) // Max resolution ( 128×96@30 or 176×144@15 )
Level 1b = 148.5 * 1024 / ( width * height * 1.5) // Max resolution ( 128×96@30 or 176×144@15 )
Level 1.1 = 337.5 * 1024 / ( width * height * 1.5) // Max resolution ( 176×144@30 or 320×240@10 )
Level 1.2 = 891.0 * 1024 / ( width * height * 1.5) // Max resolution ( 176×144@60 or 320×240@20 )
Level 1.3 = 891.0 * 1024 / ( width * height * 1.5) // Max resolution ( 352×288@30 )
Level 2 = 891.0 * 1024 / ( width * height * 1.5) // Max resolution ( 352×288@30 )
Level 2.1 = 1782.0 * 1024 / ( width * height * 1.5) // Max resolution ( 352×288@30 )
Level 2.2 = 3037.5 * 1024 / ( width * height * 1.5) // Max resolution ( 352×288@50 or 640×480@15 )
Level 3 = 3037.5 * 1024 / ( width * height * 1.5) // Max resolution ( 720×480@30 or 720×576@25 )
Level 3.1 = 6750.0 * 1024 / ( width * height * 1.5) // Max resolution ( 1280×720@30 )
Level 3.2 = 7680.0 * 1024 / ( width * height * 1.5) // Max resolution ( 1280×720@60 )
Level 4 = 12288.0 * 1024 / ( width * height * 1.5) // Max resolution ( 1920×1088@30 or 2Kx1K@30 )
Level 4.1 = 12288.0 * 1024 / ( width * height * 1.5) // Max resolution ( 1920×1088@30 or 2Kx1K@30 )
Level 4.2 = 13056.0 * 1024 / ( width * height * 1.5) // Max resolution ( 1920×1088@60 or or 2Kx1K@60 )
Level 5 = 41400.0 * 1024 / ( width * height * 1.5) // Max resolution ( 2560×1920@30 )
Level 5.1 = 69120.0 * 1024 / ( width * height * 1.5) // Max resolution ( 4Kx2K@30 or 4096×2304@25 )

Hope its all k, will recheck tomorrow.

juGGaKNot
23rd April 2009, 23:03
Also, sorry for the bump, what is the formula for calculating filesize in 2pass ?

LoRd_MuldeR
23rd April 2009, 23:07
Also, sorry for the bump, what is the formula for calculating filesize in 2pass ?

Filesize = Bitrate * Duration

Usually <Duration> is in seconds and <Bitrate> is in kilobits per second. Hence <Filesize> will be in kilobits. Divide that through 8192 to get the size in megabyte.
Example: 120 minutes * 795 kbps = 7200 seconds * 795 kbps = 5724000 kilobit = 698 megabyte.

And take care: When you calculate the bitrate for a 2-Pass encode, you must take the size of the audio stream into account too!

juGGaKNot
26th April 2009, 18:27
Filesize = Bitrate * Duration

Usually <Duration> is in seconds and <Bitrate> is in kilobits per second. Hence <Filesize> will be in kilobits. Divide that through 8192 to get the size in megabyte.
Example: 120 minutes * 795 kbps = 7200 seconds * 795 kbps = 5724000 kilobit = 698 megabyte.

And take care: When you calculate the bitrate for a 2-Pass encode, you must take the size of the audio stream into account too!

cheers.

b66pak
26th April 2009, 18:54
and the overhead of the container...
_