Mencoder Settings For The Wiz


Optimistic

Still Fresh
Joined
Jun 30, 2006
Messages
68
Location
Germany
Website
Visit site
I'm putting together a script to convert some videos for the Wiz, but I have a few questions.

Here is the relevant line from the script:

Code:
mencoder "$file" -ofps 23.976 -oac mp3lame -lameopts abr:br=128 -ovc xvid -xvidencopts pass=2:bitrate=400 -vf scale=320:240 -o new_"$file".avi

This works just fine for videos that are already 4/3, but it squishes movies (either 1.85/1 or 2.35/1). So, first question: How do I maintain the original aspect ratio without cropping while still reducing the resolution to the Wiz's 320/240---any way to add black-borders, for example?

Second question: I have a few black and white movies, but when I encode them with mencoder, there are green artifacts. Any way to encode in black and white?
 
You won't get around doing some math, I'm afraid. For optimal results you should resize to the closest multiple of 4.

Say... input is 1280x720 (aka 720p)

1280/320=4

720/4=180

180/4=45 - what a coincidence ;)

So, 320x180 it is.

Another one... 848x480.

848/320=2.65

480/2.65=181.1320754716981132075471698

round(181.1320754716981132075471698/4)*4=180

And again it's 320x180.
 
Optimistic said:
I'm putting together a script to convert some videos for the Wiz, but I have a few questions.

Here is the relevant line from the script:

Code:
 mencoder "$file" -ofps 23.976 -oac mp3lame -lameopts abr:br=128 -ovc xvid -xvidencopts pass=2:bitrate=400 -vf scale=320:240 -o new_"$file".avi

This works just fine for videos that are already 4/3, but it squishes movies (either 1.85/1 or 2.35/1). So, first question: How do I maintain the original aspect ratio without cropping while still reducing the resolution to the Wiz's 320/240---any way to add black-borders, for example?

-vf scale=320:-10,expand=320:240

The -10 tells it to scale to the nearest mod16 value honouring aspect ratio, expand will center the scaled video in a 320x240 black frame.
 
Last edited by a moderator:
Optimistic said:
Great! These solutions work nicely for the aspect ratio issues.

Any thoughts on the black and white issue?
Yes, don't use xvid as your codec. Try -ovc lavc -lavcopts vcodec=mpeg4 -ffourcc DIVX

-oac lavc : use libavcodec libraries
-lavcopts vcodec=mpeg4 : use libavcodec's implementation of mpeg4 (divx / xvid compatible)
-ffourcc DIVX : by default mencoder sets the fourcc value in the AVI file (which tells players what codec was used) to FMP4 which few players actually understand as a valid value. using this command line swich forces mencoder to set it to the value you provide, in this case DIVX, which will make the file more universally compatible. Not sure if this is necessary for the Wiz or not - but it's "free" to set (i.e. costs no time) so why chance it? :)
 
Last edited by a moderator:
forgeflow said:
Optimistic said:
Great! These solutions work nicely for the aspect ratio issues.

Any thoughts on the black and white issue?
Yes, don't use xvid as your codec. Try -ovc lavc -lavcopts vcodec=mpeg4 -ffourcc DIVX

-oac lavc : use libavcodec libraries
-lavcopts vcodec=mpeg4 : use libavcodec's implementation of mpeg4 (divx / xvid compatible)
-ffourcc DIVX : by default mencoder sets the fourcc value in the AVI file (which tells players what codec was used) to FMP4 which few players actually understand as a valid value. using this command line swich forces mencoder to set it to the value you provide, in this case DIVX, which will make the file more universally compatible. Not sure if this is necessary for the Wiz or not - but it's "free" to set (i.e. costs no time) so why chance it? :)

XviD works fine for Wiz, so I don't see a need for DivX. Plus, isn't XviD more universally compatible than DivX anyway? XviD is, afterall, free and open source, while DivX is proprietary.
 
Last edited by a moderator:
Optimistic said:
XviD works fine for Wiz, so I don't see a need for DivX. Plus, isn't XviD more universally compatible than DivX anyway? XviD is, afterall, free and open source, while DivX is proprietary.

You are confused. Xvid, Divx, 3vix, and libavcodec are all implementations of the same video standard - mpeg4 ASP. So using libavcodec to create a "divx" compatible stream is no more proprietary than using xvid to do the same thing.

I suggested using libavcodec instead of xvid for the reason that you were complaining about green pixels in a greyscale video. This is a known issue with xvid. Xvid may be open source, but it has fallen behind the times. Libavcodec is a much more robust, and feature complete implementation of the same video standard, and is about as good as it can get without using h264.
 
Last edited by a moderator:
Back
Top