[MEncoder-users] Flashvideo for YouTube using mencoder

Ben jultus at gmail.com
Sat Feb 23 05:09:07 CET 2008


On Sat, Feb 23, 2008 at 2:55 AM, Corey Hickey <bugfood-ml at fatooh.org> wrote:

>  ...and, furthermore, if you use one-pass encoding and happen to find
>  some settings that give you the bitrate you want, you'll likely find out
>  that those same settings result in a widely different bitrate when you
>  encode a different video.

I must say that I haven't really noticed a lot of that with all the different
sources I have encoded to FLV in recent months. I've been quite lucky in
how the desired maximum was always closely matched with a one-
pass command.
However, just last night I did some tests with two-pass encoding
on a fairly hard to encode source. Hard because the clothes
have a thin lining, which ffmpeg has a hard time keeping sharp.
Here's the best I could get below 349 kbit/s (audio+video) :
http://youtube.com/watch?v=rQHuDQ0XjvE

This time I used:

"c:\base\v\automen\mencoder.exe" "e:\paulinevicv.avi" -o pvj.flv -mc 0 -ofps 25
-srate 44100 -oac mp3lame -lameopts vbr=2:q=8:aq=0:mode=1:lowpassfreq=17200
-ovc lavc -of lavf -lavfopts format=flv -lavcopts
vcodec=flv:vbitrate=236:keyint=125:
mbd=2:trell:v4mv:cbp:last_pred=3:predia=4:dia=4:preme=2:vpass=1
"c:\base\v\automen\mencoder.exe" "e:\paulinevicv.avi" -o pvj.flv -mc 0 -ofps 25
-srate 44100 -oac mp3lame -lameopts vbr=2:q=8:aq=0:mode=1:lowpassfreq=17200
-ovc lavc -of lavf -lavfopts format=flv -lavcopts
vcodec=flv:vbitrate=236:keyint=125:
mbd=2:trell:v4mv:cbp:last_pred=3:predia=4:dia=4:preme=2:vpass=2

Sure, for this video I could have chosen a much higher keyint, but I
wanted to see
what it would do on the striped stuff on the clothes (which moves fast
and often).
By the way;
It should be noted that people highly underestimate the power of lame's VBR
for the audio in such videos. I mean, just listen to that and guess
the audio bitrate.
Lame can do in joint stereo vbr what other codecs can't even do with
double the rate.

>  On a single pass (or the first of two), lavc makes a halfhearted attempt
>  to meet the bitrate the user specified. I say halfhearted because lavc
>  can, should, and will vary the number of bits it spends on individual
>  frames. This makes the bitrate fluctuate widely in response to
>  characteristics of the input video. Lavc does not know when the video is
>  going to end. If the video ends during a high-motion sequence, lavc will
>  may have just spent many bits and the overall average bitrate will be
>  high; if the video ends in a low motion sequence, the overall average
>  could be low.

I did notice at times that with longer videos (over 10 minutes)
the estimates with a 1-pass go wrong in that they use lower
quality in the later parts of the video for very similar content
that looks fine in the beginning of the same encode.
This was solved for the most part doing a two-pass encode.

>  By the way, if you want lavc to meet your requested bitrate more
>  precisely, investigate the vratetol option. This is more relevant with
>  smaller videos.

That already looked interesting to me, but I find it hard to guess
how tolerant I should set it. I hardly see any true-to-life examples
for flashvideo (not in this list, or in the manual).
Do you have an idea what to set vratetol to, on average, for,
say, videos of minimum 3 to maximum 11 minutes ?
For audio I need around ~96 kbit/s, so if the target is 349 kbit/s maximum,
that leaves around 253 kbit/s for video.

Also, does anybody here have an opinion on using mencoder instead of ffmpeg
directly? I've been using ffmpeg for encoding to flv, but it made huge mistakes
on interpreting the source. For some reason mencoder takes better guesses
for my sources (usually huffYUV or RAW RGB bitmap avi's). I also found the
mencoder encodes a lot less blocky in color gradients. This might depend
on the versions used, I have no idea how mencoder rates against ffmpeg
regarding internal codec code.

Where to find the best and latest Win32 or Win64 binaries for mencoder ?

Anyhow, thanks for the advice thus far. It's all been very enlightening.

JB



More information about the MEncoder-users mailing list