Page 1 of 1

Encoding to a target size

Posted: 18 Apr 2005 21:37
by videoip
Is there any way I can encode a video to get a predictable file size? I try to calculate size=length*(audiobitrate + videobitrate), but I always get a file a lot larger than calculated.
Could you at least tell me why this is? I´ve tried different muxers and codecs and that makes the file size vary, but I always find this quite unpredictable.

Posted: 19 Apr 2005 13:10
by The DJ
It's because next to video and audio, there is a lot more in a file. This is called the muxing overhead. various fileformats have various amounts of overhead. Predicting this exactly is almost impossible. You just need to make an educated guess.

educate me :-)

Posted: 20 Apr 2005 20:17
by videoip
Thanks for the info. Now, how do I "educate" myself in this? I´m trying to predict the size of a h264 video on TS. Do muxer overheads weigh less on longer files? Please tell me where I can read more on any of this.

Posted: 21 Apr 2005 02:16
by markfm
mpeg ts chops things up into little 188 byte packets. The norm in VLC is to then put 7 of these packets together into one Ethernet packet (since 7x188 < 1500 bytes, a "normal" MTU)

Do a search for ISO 13818-1 on the Web -- it gives you the definition of what is in a transport stream (a bit of a slog, admittedly).

Alternately, take a look at:
http://www.leitch.com/resources/tutoria ... ystems.pdf

see page 47 of the document, which gives you a glimpse of the kinds of TS packets.