View Single Post
Old 03-19-2007   #1 (permalink)
Member shookie is on a distinguished road
 
Join Date: Mar 2007
Posts: 108
Linux script for mencoder.

Ok i got something going.

I'm using Ubuntu Egdy.

Install mencoder if you haven't already.

Debian/Ubuntu:

Code:
sudo apt-get install mencoder
In the command line type: I use nano as a text editor. Change it to your favorite editor:
Code:
sudo nano /usr/bin/meizu-convert
This will open a text editor and create the file meizu-convert in /usr/bin.

Put the following code in the text editor. Make sure you change mencoder path so that it points to it. And also set the output path.:
Code:
#!/bin/bash
#This script uses mencoder to convert movies to a playable AVI format for the MEIZU M6
 
mencoder=/usr/bin/mencoder
outputpath=/media/DataStorage/meizuvid/
 
if [ $3 -a $1 == cropbar ]
then
    #Crop black bars on widescreen video.
    $mencoder $2 -idx -noodml -ofps 18 -vf scale=427:240,expand=:240:::1,crop=320:240,rotate=1 -ovc lavc -ffourcc XVID -lavcopts vcodec=mpeg4:vbitrate=256:vmax_b_frames=0:vhq -sws 9 -oac mp3lame -lameopts cbr:mode=2:br=96 -af resample=44100 -srate 44100 -o $outputpath[M6]$3
 
else 
    echo Unknown variable $1
    #Default conversion settings
    $mencoder $1 -idx -noodml -ofps 18 -vf scale=320:-2,expand=:240:::1,crop=320:240,rotate=1 -ovc lavc -ffourcc XVID -lavcopts vcodec=mpeg4:vbitrate=256:vmax_b_frames=0:vhq -sws 9 -oac mp3lame -lameopts cbr:mode=2:br=96 -af resample=44100 -srate 44100 -o $outputpath[M6]$2
 
fi
 
exit 0
Save your document and exit. Now we must allow the script to execute.
In the command line type:
Code:
sudo chmod +x /usr/bin/meizu-convert
Now to convert a movie type in the command line:
Code:
meizu-convert [SOURCE FILE] [DESTINATION FILE]
If the video is widescreen you can crop the black bars by typing:
Code:
meizu-convert cropbar [SOURCE FILE] [DESTINATION FILE]
I'm adding more options as i see fit for my needs.

Last edited by shookie : 04-04-2007 at 03:36 AM. Reason: Stable.
shookie is offline   Reply With Quote