[MEncoder-users] 2pass: auto-calculation of bitrate?
James Hastings-Trew
jimht at shaw.ca
Tue Oct 16 15:50:54 CEST 2007
Ilya Zakharevich wrote:
> [A complimentary Cc of this posting was NOT [per weedlist] sent to
> RC
> <mencoder-users at mplayerhq.hu>], who wrote in article <20071016005014.706662b4.cooleyr at gmail.com>:
>
>>>> This is certainly not workable. There is no average "action" movie.
>>>>
>>>> For the purposes at hand, obviously there is. Just catenate 1000
>>>> randomly chosen action movies together. ;-)
>>>>
>>>> Certainly. You'll find an average bitrate, and it will look perfect for
>>>> some movies, and look terrible for others.
>>>>
>>>>
>>>>
>>>> Of course. And this is absolutely irrelevant.
>>>>
>>>>
>> Whether a certain bitrate will looks fine (average) across 1000
>> movies depends entirely on the individual movies.
>>
>
> This does not parse. The average will not depend much on the choice
> of a (random) collection of 1000 movies. Individual movies in this
> thousand may be very different - and the algorithm I described will
> take care of this.
>
>
>> One set of 1000 action movies will require a much,
>> much higher average bitrate than another set of 1000.
>>
>
> Not if they are "random" - as any particular collection is.
>
>
>>> It is natural to expect that a reasonally working 35mm movie camera
>>> would capture enough info to present in 2megapixel frames
>>>
>> This has nothing to do with pixel count. Encoding difficulty is about
>> noise.
>>
>> Again, noise depends on the choice of film and of the scene, not on
>> the camera..
Oy. At the risk of wading into this mess, RC is right. Compressability
has nothing whatever to do genre, it has to do with the amount of
redundant information from frame to frame. This has more to do with -
focal depth of the lens used, how steady the camera platform is, how
accurate the film gate in the camera is, how much grain is in the film
stock, how the scene was lit, etc. This will effect how "hard" the edges
in the image are (hard edges take more bits to compress than soft
edges), how much random movement there is from frame to frame with
stationary objects (more motion vectors from frame to frame requires
more bits), and how much noise there is in the frame (fine detail, even
if random noise requires more bits).
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. Encode 5% of a movie by compressing 10 scenes at regular
intervals throughout the movie with a constant quality factor, and then
use the size of the resulting file x 20 as an estimate of how big that
movie will likely be at that quality factor, and then derive your
bitrate based on that.
Your proposed method is literally a shot in the dark because the choice
movies that you choose to average would affect the bitrate value you
obtain. You'd get faster results by using a simple "bits per pixel"
calculation instead. .25 bits per pixel is a good "average" value for
most movies from high quality sources - (width * height * framerate *
.25)/1000 will give you a bitrate you can work with. It certainly will
be as valid a number you get from any averaging operation, which is to
say not very. One size really doesn't fit all.
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.
More information about the MEncoder-users
mailing list