Symfony 2 Crash Course
Enforce Coding Standards with PHP_CodeSniffer and Eclipse IDE on Ubuntu Linux
Installing Xdebug for use with Eclipse or Netbeans on Linux
A Simple ISAPI Filter for Authentication on IIS
Book Review: How to Implement Design Patterns in PHP
Development Resource Project

Scaling and Cropping AVI with mencoder

Sunday, 14 November 10, 3:22 pm
The following are mencoder's video filter options, and must be specified after -vf. You can specify multiple filters, by separating them with a comma, and the filters will be applied left to right.
mencoder [options] file INPUTFILE -o OUTPUTFILE   crop[=w:h:x:y] Crops the given part of the image and discards the rest. Useful to remove black bands from widescreen movies. <w>,<h> Cropped width and height, defaults to original width and height. <x>,<y> Position of the cropped picture, defaults to center.   scale[=w:h[:ilaced[:chr_drop[:par[:par2[:presize[:noup[:arnd]]]]]]]] Scales the image with the software scaler (slow) and performs a YUV<->RGB colorspace conversion (also see -sws).   <w>,<h> scaled width/height (default: original width/height) NOTE: If -zoom is used, and underlying filters (includ- ing libvo) are incapable of scaling, it defaults to d_width/d_height! 0: scaled d_width/d_height -1: original width/height -2: Calculate w/h using the other dimension and the prescaled aspect ratio. -3: Calculate w/h using the other dimension and the original aspect ratio. -(n+8): Like -n above, but rounding the dimension to the closest multiple of 16.   <ilaced> Toggle interlaced scaling. 0: off (default) 1: on   <chr_drop> chroma skipping 0: Use all available input lines for chroma. 1: Use only every 2. input line for chroma. 2: Use only every 4. input line for chroma. 3: Use only every 8. input line for chroma.   <par>[:<par2>] (also see -sws) Set some scaling parameters depending on the type of scaler selected with -sws. -sws 2 (bicubic): B (blurring) and C (ringing) 0.00:0.60 default 0.00:0.75 VirtualDub "precise bicubic" 0.00:0.50 Catmull-Rom spline 0.33:0.33 Mitchell-Netravali spline 1.00:0.00 cubic B-spline -sws 7 (gaussian): sharpness (0 (soft) - 100 (sharp)) -sws 9 (lanczos): filter length (1-10)   <presize> Scale to preset sizes. qntsc: 352x240 (NTSC quarter screen) qpal: 352x288 (PAL quarter screen) ntsc: 720x480 (standard NTSC) pal: 720x576 (standard PAL) sntsc: 640x480 (square pixel NTSC) spal: 768x576 (square pixel PAL)   <noup> Disallow upscaling past the original dimensions. 0: Allow upscaling (default). 1: Disallow upscaling if one dimension exceeds its original value. 2: Disallow upscaling if both dimensions exceed their original values.   <arnd> Accurate rounding for the vertical scaler, which may be faster or slower than the default rounding. 0: Disable accurate rounding (default). 1: Enable accurate rounding.
The target resolution I'm aiming for is 480x220. This is a strange resolution, as the height is not divisible by 16: 208 is the nearest even multiple of 16. For a film in 596x326 resolution, first it should be scaled to 480x(326x480/596) = 480x262.55, then cropped to 480x208:
mencoder -oac copy -ovc xvid -xvidencopts pass=2:bitrate=12000 -vf scale=480:-2,crop=480:208
If you're not sure what bitrate to choose, you can specify a target filesize, in kilobytes, by giving a negative value for the bitrate parameter. So to get mencoder to create an output file around 700 Mb in size, use the following:
mencoder -oac copy -ovc xvid -xvidencopts pass=2:bitrate=-700000 -vf scale=480:-2,crop=480:208

Extracting Audio from an AVI Video as MP3

This can be done with mencoder like so:
mencoder inputfile.avi -of rawaudio -oac mp3lame -ovc copy -o outputfile.mp3


9:52 am, Tuesday, 16 April 13

Leave Comment

/xkcd/ Real Estate

About This Page