Re: Re: XviD-users Digest, Vol 14, Issue 2
Wes Shull <[email protected]> Wed, 24 Mar 2004 18:45:52 -0700
| Newsgroups | gmane.comp.video.xvid.user |
|---|---|
| Message-ID | <[email protected]> |
Santhosh <[email protected]> > Thanks for the advice. I did exactly as you mentioned and got the job > done. But while doing the second pass, I had to guess the bitrate value to > get the file of desired size. Is there some neat way of finding the > bitrate value exactly, which results a file of desired size. Er, well there are a probably a billion places out there that have bitrate calculators and explanations of all this, but I'll be nice and give you the basics. You need to know: * Duration of your material. For ease of computation, figure this out in seconds. * How big you want the encoded file to be. If you're trying to fit it on a CD, keep in mind that the "MByte" are really MiByte... for example a 700-MB cd is 700 * 1024 * 1024 bytes (usually a tiny bit more, varies from brand to brand--use the 700 number and you're generally safe). Multiply this by 8 to get the number of bits. * What audio bitrate you're using. These are usually specified in kbit/sec; for example a 128k MP3 stream is 128 * 1000 bits per second. Now, your total bitrate is just going to be final size (in bits) / duration (in seconds). Then your video bitrate is total bitrate (bits/sec) - audio bitrate (bits/sec) Last, since XviD takes the bitrate in kbit/sec, divide the bitrate by 1000. Now there is some overhead to any container format (avi, ogm, mkv, asf, whatever). If you're bored you can go look it up and try to work it out exactly, but there's also the issue that the rate control (remember all video is VBR; the bitrate you're specifying is the target *average* bitrate for the whole file), while very good, is not *perfect*... so I generally just multiply my final video bitrate by 0.99 (i.e. reduce it by 1%) to allow for both of those. You may want to fudge it more, depending on how well it works for your settings. Example: encoding a 100-minute video with 128k audio to fit a 700 mb CD: duration = 100 * 60 = 6000 sec final size = 700 * 1024 * 1024 * 8 = 5 872 025 600 bits audio bitrate = 128 * 1000 = 128 000 bits/sec total bitrate = 5 872 025 600 bits / 6000 sec = 978 671 bits/sec video bitrate = 978 671 bits/sec - 128 000 bits/sec = 850 671 bits/sec video kbitrate = 850 671 bits/sec / 1000 bits/kbit = 851 kbit/sec fudged video kbitrate = 851 kbit/sec * 0.99 = 842 kbit/sec so you would use bitrate=842 in your -xvidencopts.