[mdlug] Converting DVDs to play on a Palm

Ingles, Raymond Raymond.Ingles at compuware.com
Thu May 31 18:03:18 EDT 2007


 I got a spare 512MB SD card and decided to try this out, since I'd heard of
people doing it. So, I did some googling and put together a script or two to
handle this.

 Basically, you use "mencoder" to read the DVD and convert it to DIVX format,
scaling the video to fit the 320x320 screen. I also compress the audio to
128Kbit MP3 format, since I don't need a Dolby soundtrack. :-> I've had very
good results with a 224Mbit/sec video rate. It looks quite good on the screen,
better than VHS (certainly richer color).

 Last night I converted the movie "Aliens". It's a 154-minute movie in 16x9
format. It converted down to a 320x180 image, and takes up 403MB on the card.
That took approximately an hour and twenty minutes on my dual-2GHz Athlon
system. (If I used one-pass encoding it would have been about half that.)

I let the movie run all the way through (two hours and 34 minutes) today as
the Treo 650 sat on my desk as I worked (with the sound muted) and my battery
went from 99% to 77%. Not bad.

 It's a toy, sure, but might be fun on a long trip. I could fit five or six
half-hour TV shows on my card easily. Anyway, if anyone's interested, the
script I use is below.

 Sincerely,

 Ray Ingles                                   (313) 227-2317
 
 "Computers let you make more mistakes faster than any other
 invention in human history, with the possible exception of
        handguns and tequila." - Mitch Radcliffe

---begin dvd2palm.sh---
#!/bin/sh

# Converts DVDs to AVI files suitable for viewing on a Palm w/TCPMP

# If you're skipping frames, increase FPS. If duplicating, decrease FPS.
# Usual values are 24000/1001 (23.976), 24, 25 (PAL), 30000/1001 (29.97), 30.
FPS=24000/1001

# My Palm has a 320x320 screen. If you have a 480x320 screen, try "480" here.
SCALEW=320

# Set audio mode - these are arranged in decreasing order of likelyhood
# to sync properly

# Full AC3 audio, takes up a fair amount of space.
#AUDIO=copy
# Constant bit rate MP3, the 'br' field sets the bit rate
AUDIO="mp3lame -lameopts cbr:br=128"
# Average bit rate MP3, the 'br' field sets the bit rate
#AUDIO="mp3lame -lameopts abr:br=128"
# Variable bit rate MP3, sometimes has sync problems
#AUDIO="mp3lame -lameopts vbr=3"

# Set crop, if needed
# Get these numbers by running the command: mplayer -ss 60 -vf scale=320:-2,cropdetect dvd://[track number]
#CROP=",crop=320:160:0:28"

# For mixed progressive/telecined content
#PULLUP=",pullup,softskip"

# Set video bit rate, feel free to experiment here to see what fits
VBITRATE=224
#VBITRATE=336
#VBITRATE=448

# Use DIVX
DIVX="-ffourcc divx"

# These are the key parameters we gotta have from the user.
# Spaces in the output file name are probably not a good idea.
DVDTITLE=$1
NEWNAME=$2.avi

# These are optional parameters that can be tweaked but have default values.
# You might want to change the default to match your system.
DVDDEV=${3:-"/dev/dvd"}
# 128 is the default audio track on a DVD, usually
AUDIOTRACK=${4:-128}

# Make sure we got the minimum info needed.
if [ -z "${DVDTITLE}" -o -z "$2" ]; then
 echo "Usage: " $0 " dvd-title output-name [dvd-device] [audio-track]"
 exit -1
fi

# Just in case one's left over from a previous encoding run.
rm -rf divx2pass.log

# Two-pass encoding, takes longer but produces best quality for a given bitrate
mencoder -dvd-device ${DVDDEV} dvd://${DVDTITLE} -aid ${AUDIOTRACK} -ovc lavc -lavcopts vcodec=mpeg4:vpass=1:vbi
trate=${VBITRATE} -ofps ${FPS} ${DIVX} -oac ${AUDIO} -vf scale=${SCALEW}:-2${CROP}${PULLUP} -o /dev/null

mencoder -dvd-device ${DVDDEV} dvd://${DVDTITLE} -aid ${AUDIOTRACK} -ovc lavc -lavcopts vcodec=mpeg4:vpass=2:vbi
trate=${VBITRATE} -ofps ${FPS} ${DIVX} -oac ${AUDIO} -vf scale=${SCALEW}:-2${CROP}${PULLUP} -o ${NEWNAME}

# Clean up after ourselves.
rm -rf divx2pass.log
----end dvd2palm.sh----

The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it. 



More information about the mdlug mailing list