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 > Announcements and Chat > General Discussion

Reply
 
Thread Tools Search this Thread Display Modes
Old 5th December 2006, 22:20   #1  |  Link
morph166955
Registered User
 
Join Date: Mar 2006
Posts: 443
avi overhead question...where is this # comming from?

So ive been working on a little formula to estimate the avi overhead that would be in a file so that i can more accurately predict the video bitrate to use to get a target size (yea i know, LOTS of software does this already). From using google and the search on here and all that stuff I have my formula down to a very good level of estimation (im averaging ~37.5KB over my target size). While this is close, im shooting for near perfection (or atleast a little closer then what i have now)...its almost just to see if i can do it at this point since 38KB is really nothing.

The reason im doing this is because mencoder's estimation has been decently off from what im looking for (in the range of a few kb to 5-10 meg per file, which builds up enough to cause problems with dvd's). The way that my formula works is by taking specific information outputed by mencoder from the first pass, running that through the formula, and giving a bitrate to within a bit/s which is then sent too the second pass. My formula is:

( ( ( SizeRequested - AudioSizeFromMencoder ) / VideoDuration ) - ( 66 * 24 ) ) * 8 = bitrate

I generated this formula based on data from several runs on the same file with different bitrates requested. Now i know what your all saying...what is this 66*24 garbage. Well I have half of an answer, but if someone could fill me in on the second half then that would be nice. from my research, avi overhead is generated in 24byte blocks. My math has shown that i get almost exactly 66 of these blocks per second no matter what bitrate im using. My question is...what makes up the 66 blocks? i know ~24 of them are from the video frames so i must assume the other 42 are the audio, but why? I couldn't find a more in depth answer too this anywhere and the answers i found weren't really explaining anything either.

im using 24000/1001 fps, lamemp3 @ preset=128 for audio and lavc w/ options of vcodec=mpeg4:mbd=2:trell:v4mv:turbosnr plus the vpass/vbitrate options for the video. If anyone wants more info i can include that also but i think that should suffice for the purposes of this question. I have a feeling that the answer to my problem has to do with either the frame rate not being precisely 24 but rather 23.96, or something to do with the different video frames being used in the encode but i could be wrong on both counts with those.

Thanks all.
morph166955 is offline   Reply With Quote
Old 5th December 2006, 22:51   #2  |  Link
GodofaGap
Registered User
 
Join Date: Feb 2006
Posts: 823
- overhead is 24 bytes per chunk for standard, and 16 bytes per chunk for OpenDML AVI
- for video a chunk is one frame
- for CBR audio a chunk can have any length so you will have to know what your muxer is using
- for VBR audio a chunk is commonly 1 audio frame long (e.g. 1152/samplerate for MP3)
- the header can practically have any size, so again you will have to look at the muxer
GodofaGap is offline   Reply With Quote
Old 5th December 2006, 23:02   #3  |  Link
morph166955
Registered User
 
Join Date: Mar 2006
Posts: 443
that much i understand and have gotten from my research...i was hoping for a more, mathematical approach to explain why im getting 66 as this magical # and what I can do to make my formula more accurate.
morph166955 is offline   Reply With Quote
Old 5th December 2006, 23:18   #4  |  Link
GodofaGap
Registered User
 
Join Date: Feb 2006
Posts: 823
If you'd understand you wouldn't be asking why you got 66.

The formula you really should be using is:

overhead = ([# of video chunks]+[# of audio chunks])*24 + headersize (for standard AVI)

~66 chunks per seconds sounds like you have 48kHz VBR mp3 audio as that gives 41.66 audio frames per sec.
GodofaGap 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 03:37.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.