morph166955
5th December 2006, 22:20
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:turbo:psnr 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.
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:turbo:psnr 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.