OESF Portables Forum
General Forums => General Discussion => Topic started by: JerryAttrix on December 11, 2004, 06:56:49 am
-
Here's a small Linux script, with documentation, to rip a track from a DVD and convert it to a form suitable for playing on a Zaurus using Kino2. One of the new 1GB SD cards will hold up to 5 full-length movies converted this way.
I'm posting because I haven't seen it anywhere else on the Forum...
-- GT
----------------------------------------------------------------------------------
#!/bin/sh
#######################################################################
# dvd2z
#
# This script is a front end for mencoder to convert a track of a DVD
# into a format suitable for playing on a PDA using Kino2 or equivalent.
# The resulting AVI requires about 80MB/hour using the settings below,
# so a full feature film will fit comfortably onto a 256MB flash card.
# (Terminator 3 needs 188MB)
#
# Some things you may want to alter:
#
# The track number is usually 1 for the main feature of a film.
#
# The video bitrate is set here at 192kbps ("vbitrate=192"). Try
# experimenting with lower values until the quality is unacceptable.
#
# The audio bitrate is 64kbps ("br=64"). Can be reduced but not a lot
# to gain.
#
# Brightness usually has to be boosted for PDA; here it's set to 6
# using "eq=6". Leave this option out for standard brightness.
#
# Frame size is 320:240. Can be changed but the scaler may not like it
# on replay.
#
# Frame rate can be reduced to 15 ("-ofps 15") to give player less
# work. Makes a small saving in file size.
#
# Mono audio - a small saving - can be done using "mode=3".
#######################################################################
if [ $# -lt 2 ]
then
echo "Usage: dvd2z
-
You might want to exit with status 1 after your checking ifloop.
The list of swtches is really handy though
-
Addendum regarding widescreen movies:
To keep the aspect ratio right but still within a 320x240 window, I've found I need a two-pass approach (though I'd welcome suggestions on how to do it in one). The first thing is to add a suitable border top and bottom to the movie; after that it can be encoded to 320:240. The aspect ratio of movies varies so some experimentation is needed, but the following worked for The Bourne Identity:
----------------------------------------------------------------------------------
mencoder dvd://$1 -chapter 8 -oac copy -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=4000:vhq -vf expand=0:-160:0:80 -o temp.mpg
mencoder temp.vob -ovc lavc -lavcopts vcodec=mpeg4:vhq:vqmin=2:vqmax=20:vmax_b_frames=2:vbitrate=192:vqcomp=0.6:vpass=1 -vop scale=320:240,eq=6 -ofps 25 -sws 2 -oac mp3lame -lameopts abr:br=64:aq=1:mode=0 -srate 24000 -o "$2".avi
rm -f temp.mpg
----------------------------------------------------------------------------------
In the first command, the DVD is ripped to a high-quality MPEG, with 160 pixels added to its height and the picture offset by 80 pixels to keep it centered. The second command then writes the result to an MPEG4 AVI.
-
Sorry, I accidentally left in some test code: the "-chapter 8 is redundant. Should be:
mencoder dvd://$1 -oac copy -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=4000:vhq -vf expand=0:-160:0:80 -o temp.mpg
mencoder temp.mpg -ovc lavc -lavcopts vcodec=mpeg4:vhq:vqmin=2:vqmax=20:vmax_b_frames=2:vbitrate=192:vqcomp=0.6:vpass=1 -vop scale=320:240,eq=6 -ofps 25 -sws 2 -oac mp3lame -lameopts abr:br=64:aq=1:mode=0 -srate 24000 -o "$2".avi
rm -f temp.mpg
-
Second oops: The file parameter in the second line should read temp.mpg, not temp.vob.
Must be getting tired...
-
Second oops: The file parameter in the second line should read temp.mpg, not temp.vob.
Must be getting tired...
I corrected it