Gp2x Mencoder Bash Script


dedeibel

Active Member
Joined
Oct 7, 2005
Messages
544
Location
Germany
Website
Visit site
Hi,

I created a bash script for encoding Videos with mencoder (mplayer) for the gp2x and thought maybe someone finds it usefull. It is meant for ppl who don't like to remember their default settings and have the gp2x-ready movies in one directory.

You can set a default directory (outputDir) and most of the time it is enough to type "reencode in <file ...>". I tried a lot of encoding settings and set the best as default.

Examples:
Code:
reencode in justdoit.avi

reencode dvd 2 sample 45m
reencode -d 1-2 out /tmp/mymovie.avi extra -chapter 4-8 -alang jp
reencode -i ~/greatmovie.mpg -sub ~/sub.srt codec xvid rate 300 cartoon
reencode in oneFile.avi anotherFile.mpg
reencode in *.mpg -o /tmp
reencode in *.mpg - out /tmp

Code:
reencode OPTION VALUE ... [-e|extra VALUES ...]

OPTIONS [default]:
-i | in       Infiles (Has to be at the end or followed by a '-')
-d | dvd      Encode from a DVD (specify titles)
-o | out      Outfile or directory [<infile>-small.avi]

-c | codec    Codec lavc,xvid [lavc]
-r | rate     Bitrate [250]
-s | scale    Scale [320:-3]
-p | pass     Passes [1]
-t | cartoon  Use cartoon mode (xvid only)

-a | audio    Audio bitrate [64]
-m | arate    Audio samplerate [22050]

-l | sample   Get a sample, specify starttime (Nh or Nm or hh:mm:ss)
-u | sub      Subtitle file [none]
-e | extra    Extra options for mencoder (Has to be the last option)

I hope you like it.

reencode


regards
dedeibel
 
By the way, i also have a preview of a modified version of the code of iGP32 to encode for GP32 or GP2X (using Mencoder) for Mac OS X, a little bit easier to use. You can get it and try it here:

http://homepage.mac.com/kounch/.Public/GP%...0Alfa%200.1.dmg

It fails sometimes when finishing encoding, but you can give it a try if you want to.

GPVideoEncoder.png
 
i have one of these scripts too, in my ~/bin dir (I'm on OSX):

[ging:~] j% cat ~/bin/gp2xmov

Code:
#!/bin/sh
mencoder -oac mp3lame  -ovc lavc -srate 22050 -lameopts cbr:br=64  -ffourcc DIVX -lavcopts \
        vcodec=mpeg4:vbitrate=350::v4mv:mbd=2:trell:cmp=3:subcmp=3:mbcmp=3 -vf scale=320:-3 \
        $1 -o $2

the way you use it is "gp2xmov infile.mpg outfile.avi" .. but if you don't want command line cage, you can automate this script to convert whatever files you drop in a folder, through Finder automation .. works very well, and i never have to worry about it .. i just put video's i want to watch in the 'gp2x movies' folder, which i drag to SD whenever i need to go gp2x-mobile ..
 
i have one of these scripts too, in my ~/bin dir (I'm on OSX):

[ging:~] j% cat ~/bin/gp2xmov

Code:
#!/bin/sh
mencoder -oac mp3lame  -ovc lavc -srate 22050 -lameopts cbr:br=64  -ffourcc DIVX -lavcopts \
        vcodec=mpeg4:vbitrate=350::v4mv:mbd=2:trell:cmp=3:subcmp=3:mbcmp=3 -vf scale=320:-3 \
        $1 -o $2

the way you use it is "gp2xmov infile.mpg outfile.avi" .. but if you don't want command line cage, you can automate this script to convert whatever files you drop in a folder, through Finder automation .. works very well, and i never have to worry about it .. i just put video's i want to watch in the 'gp2x movies' folder, which i drag to SD whenever i need to go gp2x-mobile ..

The -ffourcc DIVX codec is so old, and produces very bad encodings.
If you want better quallity videos, you can use the divx4 codec from the ffmpeg pack, or the (prefered) xvid codec.

Using ffmepg divx4 codec:
mencoder -o movie.avi -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=200:vhq -oac mp3lame -lameopts br=64:cbr -sws 2 -vop scale,lavcdeint -zoom -xy 320 INPUTFILE.XXX

Using Xvid codec:
mencoder -o movie.avi -ovc xvid -xvidencopts bitrate=200 -oac mp3lame -lameopts br=64:cbr -sws 2 -vop scale,lavcdeint -zoom -xy 320 INPUTFILE.XXX

Using Xvid codec, with maximum quallity:
mencoder -o movie.avi -ovc xvid -xvidencopts bitrate=200:gmc:qpel:vhq=1:max_bframes=8:bquant_ratio=150:bquant_offset=75:bf_threshold=0 -oac mp3lame -lameopts br=64:cbr -sws 2 -vop scale,lavcdeint -zoom -xy 320 INPUTFILE.XXX
 
Last edited by a moderator:
Back
Top