[MEncoder-users] Compressibility test for encoding with a bitrate boundary

Sebastian Kemper sebastian_ml at gmx.net
Wed Sep 3 20:12:17 CEST 2008

Hello all,

I use a script to batch-convert videos to either XviD or x264. Up till
now I used a bits/(pixel*frame) approach but somebody led me to think
that this is not a good idea.

Now I'd like to use a compressibility check instead. I still want the
script to not loose sight of a maximum bitrate chosen by its user. So if
the compressibility suggests that even the maximum bitrate allowed
wouldn't suffice to yield a certain quality at a certain resolution the
script should lower the resolution instead of increasing the bitrate.

Here's the (admittedly simple) idea how this could work:

1. Do a first pass encoding of random samples (e.g. 5 samples, each 30
seconds) of the movie adding up to 2% of the whole (2% is what I read
makes sense statistically)

2. Assume that the file size of the output times 50 is the size of a
full first pass

3. Take a percentage, e.g. 60% (no idea who came up with this number and
why) of the estimated size and calculate the bitrate this file would

4. If this is more than the bitrate boundary set by the user then lower
the resolution and start at 1. If it is less then use the calculated
bitrate for a 2-pass encoding of the full movie

Would that be a decent approach and work with both XviD and x264 (the
script supports only these two codecs)?


More information about the MEncoder-users mailing list