I know there's the '-fs' option for ffmpeg but it might just always truncate. I wanted to try it with 2 pass encoding, maybe it has a different effect ?
Anyway for constant bitrate you can calculate the output size like it says here:
http://www.mplayerhq.hu/DOCS/HTML/en...vd-mpeg4-2pass
Quote:
You can compute the bitrate with the following equation: bitrate = (target_size_in_Mbytes - sound_size_in_Mbytes) * 1024 * 1024 / length_in_secs * 8 / 1000 For instance, to squeeze a two-hour movie onto a 702MB CD, with 60MB of audio track, the video bitrate will have to be: (702 - 60) * 1024 * 1024 / (120*60) * 8 / 1000 = 740kbps
|
For variable bitrate, what I usually do is use this formula to get about what bitrate I would want, then use the '-qscale' option and watch the bitrate, if it hovers or averages to around this rate, then you are good to go (usually if it's around 800 or 900 it's good, sometimes it goes down to 600 or up to 1200, but overall the average should be about 800 to 900). If it goes over you can just cut off the credits at the end of the movie, which I usually do anyway.