e.g. bash mencode.sh dvd://
#!/bin/bash
# mencode.sh (c) 2008 linux-tipps.blogspot.com
# settings
BR=1400 # bitrate
lang=en # your language code for the DVD audio track, e.g. en/de/es
OUT=`basename "$1"`"-xvid-fast.avi" # output file in current directory
XVID="lumi_mask:interlacing:nochroma_me:me_quality=4:vhq=1:autoaspect:chroma_opt:bitrate=$BR" # xvid settings
# settings end
[ -f "$OUT" ] && echo File exists && exit 1;
echo Encoding $i
screen -O mencoder -alang $lang -cache 32768 -ovc xvid -oac copy \
-xvidencopts $XVID "$1" -o "$OUT";
You may want to compile xvid and mencoder for your machine to speed it up even more, but I've already set the xvid settings to a reasonably fast mode. I get around 25-30 fps when doing a DVD to Xvid backup on my notebook.
You could add -vf scale=640:-1 but it doesn't really increase speed, but makes it look worse. I use screen, so I can detach(Ctrl-a, Ctrl-d) from the encoding when I have to e.g. exit the current X session.
Detaching also helps to decrease unnecessary screen updates which eat cpu in many terminals. And it's better than passing -quiet as command line argument, because you now have the choice between seeing what's going on and how long it'll take or not. Screen is great... You can re-attach with screen -r. If you have several cores, try adding threads=x to the xvid options.
Black borders are not removed. If you have an idea how to do that automatically, let me know. Interlacing is kept for a good reason: Deinterlacing slows down the process and usually also degrades the quality. Deinterlacing while playing is usually the better alternative.
By the way: The most important parts are the xvid setting me_quality=4 and vhq=1 - they speed it up a lot - and compiling xvid for your processor, because some distributions don't properly compile it, even for amd64.
You may not use this script for content you do not have the rights to transcode.
{ 0 komentar... read them below or add one }
Post a Comment
Come on share your comment, but please do not spam