[MEncoder-users] frame size confusion
jimht at shaw.ca
Sun Dec 2 16:10:28 CET 2007
Dave M G wrote:
> For saving my 720x480 images as AVI files, I shouldn't be converting the
> pixel size, I should instead preserve the aspect ration. Is that correct?
As far as I know, AVI files don't store pixel aspect ratio information -
they are always assumed to be 1:1. So what you have to do is figure out
the scale based on the input aspect ratio. Fortunately, mencoder can do
that for you. If you use -vf scale=720:-10 then mencoder will take your
video and scale it to 720 wide, and whatever the height should be
according to the aspect ratio of the input divisible by 16 (for encoder
efficiency). If you use -vf scale=-10:480 then mencoder will take your
video and scale it to 480 high, and whatever the width should be, etc.
Some people subscribe to the idea that you should try to preserve as
much pixel information in your source as you can, so you would try, in
most cases, to preserve the height of the video and stretch the width.
Thus, a typical wide screen movie in NTSC would end up at 848x480 and in
PAL would end up at 1024 x 576. My attitude is that the scale should be
dictated by your end-use needs - not all videos end up being viewed on a
computer, but often are going to be used on a variety of portable or set
top devices, all of which have different pixel size limits. And,
preserving the height on PAL widescreen movies just results in
ridiculous sizes. But that's me. My point is that it is hard to give
one-size-fits-all advice on scaling parameters. But let mencoder do the
work for you where it is able to.
> If so, then what exactly is the command to do so? I looked on the
> Mencoder documentation and found this:
> But I'm unsure as to how to apply that in the command I have running.
> The example they give is:
> mencoder sample-svcd.mpg -vf crop=714:548:0:14 -oac copy -ovc lavc \
> -lavcopts vcodec=mpeg4:mbd=2:trell:autoaspect -o output.avi
> And my command is:
> mencoder input.mpg -ovc lavc -lavcopts
> -vf scale=720:406,pp=lb -oac mp3lame -lameopts preset=standard -o output.avi
> So I tried combining them, and putting the pixel scale to 720x480, like so:
> -vf scale=720:480,pp=lb -oac mp3lame -lameopts preset=standard -o output.avi
> But then I got a weird result. The image came back as 854x480 pixels,
> and it seems to have a fair amount of jpeg compression artifacts. I'm
> not sure if the compression artifacts are just more noticeable at a
> larger size, or if I've somehow hosed my quality settings.
A few things to note here:
You should always deinterlace before cropping or scaling. So your video
filter should be: -vf pp=lb,scale=720:-10.
1100 is kind of on the low side for bitrate for 720x480 sized video. I'd
recommend aiming in the ballpark of 2400 for that many pixels.
Drop all the fancy encoding options. In my experience, more often than
not, they don't help a lot. Even some of the settings recommended in the
manual for "high quality" often end up making the output video worse,
(in my opinion - and a lot of those options are going to be relative to
content of the input video). Start with some basic settings, get that
cooking right, and then start to play with some of the fancier settings
on a short length of video, and just watch the results. Try:
If that gives you a pretty good result then try adding your other
options one or two at a time and see if they help, or hinder, the final
Get the reference manual and read up on each of the options to be sure
that you understand why you want to add them and how to get the best out
of them. Some options don't make sense in the presence or absence of
other options. And once you are happy, consider doing a two pass encode
for even better quality.
Finally - before you run into problems - drop -noodml -ffourcc DIVX in
there to help AVI compatibility.
More information about the MEncoder-users