Log in

View Full Version : valid bitrate calculation


s4
22nd May 2010, 17:11
Hi! I'd like to make a valid xvid bitrate calculator for series encoding but compare to virtualdub calcs i get around 30 kbps less in my program.
First of all im reading mp3 length, and avi overhead from this via virtualdub ( mp3length / 60) * 93 kbyte

so i have these values:
targetsize: 354800KB ( 350MB )
avi overhead: 4092 KB
mp3 size: 27237 KB
videosize = targetsize - avioverhead - mp3size
bitrate = (videosize * 8) / mp3length

This gives me 973 kbps instead of virtualdub 1003 kbps, what am i missing in this calculation?

ps. sorry if i opened this topic in wrong category

mariush
22nd May 2010, 17:27
avi overhead may not be as large as 4 MB, it depends if it's AVI 2.0 or previous AVI standard, and how many keyframes there are...

s4
22nd May 2010, 17:38
Avi-legacy has 93kbyte overhead for 1 minutes video
Virtualdub overhead: 4171 kbyte
My overhead: 4092 kbyte
this difference cant be give 30kbps

mariush
22nd May 2010, 18:00
There's no fixed value like "93 KB per minute" in AVI - it depends on what video and audio codec is used, if you have one or two audio tracks in the avi file and other things...

I also believe you're making a confusion between KB and kbps. file size is in KB (1024 bytes), bitrate is in kbps or in thousands of bits.

354800 - 4092 - 27237 = 323471 KB * 1024 / 1000 = 331.234 kilobits (kb) . Divide this value to the number of seconds your movie has and you get your bitrate (kilobits / second or kbps)

s4
22nd May 2010, 18:14
XviD video and one mp3 audio.

354800 - 4092 - 27237 = 323471 KB * 1024 / 1000 = 331.234 kilobits (kb) . Divide this value to the number of seconds your movie has and you get your bitrate (kilobits / second or kbps)

331,234 / movielength ( eg. 2670 sec 44m30s ) gaves me 124. Thats maybe incorrect

mariush
22nd May 2010, 18:36
I apologize, my mistake. You'd have to multiply the value by 8 to get the result in kilobits.

The file size is measured in Kilobytes, where 1 KB is 1024 Bytes = 8192 bits so your 323.471 KB is actually 331.234.304 Bytes or 2.649.874.432 bits.
The bitrate is measures in kbps, where 1 kilobit is 1000 bits. So your size becomes 2.649.874.432 / 1000 = 2.649.874 and a half kilobits. If you divide this by 2670 seconds, you get about 992 kbps.

s4
22nd May 2010, 19:01
thanks for it!