[MEncoder-users] 2pass: auto-calculation of bitrate?

James Hastings-Trew jimht at shaw.ca
Sun Nov 23 05:44:02 CET 2008


Ilya Zakharevich wrote:
>> A better approach than trying to find some arbitrary average value 
>> across a number of unrelated movies which all have different compression 
>> needs is to "sample" each movie and compress then with a constant 
>> quality factor.
>>     
>   ^^^^^^^^^^^^^^
>
> What's this?   Quantizer?
>
>   
Did this just drop out of a way-back machine? This is a fragment of a 
pretty old discussion. :)

If I recall the discussion at the time, someone was proposing some kind 
of "rule of thumb" to guess at a 1 pass bitrate for a given movie based 
on it's genre. I gave two examples of genre movies that would invalidate 
such an approach. Then I suggested a different approach - sampling a 
portion of the movie and guessing at a good target bitrate based on that.
> Why not do something much more direct?  Like a two-pass option - but
> not with "target bitrate", but with "target average quantizer"
> (whatever meaning is appropriate)?  Or maybe it is possible now?
>   
I'm not sure what the point of that would be - you are worrying about 
bitrate because you care about file size or the bandwidth of the video 
stream - for whatever technical reasons you need to cram the movie into 
a given space, or at a given rate. Bitrate gives you that control, and 
quality is largely irrelevant. Two passes gets you closer to the target 
file size with the given amout of bits, with those bits spent in the 
best places the algorithm can work out. You use a constant quality 
factor if you care about visual quality, and size and bandwidth are not 
issues.

>> For example, consider two movies from the exact same genre - "Doom" and 
>> "28 Days Later". A bitrate derived from that simple calculation above 
>> would be way too high for "Doom" because that movie was done on quality 
>> film stock, using locked down cameras (because of the special effects 
>> work) and mostly takes place in dark environments (large areas of the 
>> image are simply black for many scenes). That same bitrate would be way 
>> too low for "28 Weeks Later" because high speed film was used in dark 
>> scenes (very high film grain) , much of the action is hand-held camera 
>> work (tons of motion vectors per frame), and most of the movie is fairly 
>> well exposed (lots of detail, foreground and background throughout). I 
>> can't see how your average value would fare any better. An average of 
>> what each movie "needs" for bitrate would give you the same end result.
>>     
>
> All true, but what is your point?  Do you think that using
> bitrate=800000 is going to be better than the "averaging approach"?
>   
Mmm.. no, I suggested a sub-sample approach, which has worked out very 
well for me, in practice. It takes about 2 minutes to take several 
sub-samples of the movie at regular intervals and derive a target 
bitrate based on the results, followed by a one-pass encode that gives 
very good results, fairly close to the target file size, in a reasonable 
amount of time. A second pass would be nice, but we all don't have 
8-core Xeon workstations. ;)




More information about the MEncoder-users mailing list