Created
January 17, 2013 00:52
-
-
Save daktak/4552535 to your computer and use it in GitHub Desktop.
2 Pass DVD to xvid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
## Usage: dvdiso2xvid_2pass.sh file.iso | |
## http://www.axllent.org/docs/video/mencoder_dvd_to_mpeg4 | |
## http://www.axllent.org/uploads/files/divxcalc.html | |
## http://quadpoint.org/projects/simplerip | |
VBR=1000 ## higher, better quality | |
ABR=128 ## 96 recommended | |
for file in "$@" | |
do | |
rm -f divx2pass.log | |
bn=`basename "$file"` | |
NameNoExt=${bn%.*} ## no extension | |
# start a timer to kill mplayer | |
(sleep 5 && killall mplayer)& | |
# start the mplayer cropdetect on DVD's chapter 4 | |
mplayer dvd://1 -dvd-device "$bn" -chapter 3 -vf cropdetect &> mplayer.tmp | |
# get last crop value from mplayer output and store in variable | |
CROP_VALUES=$(awk -F'crop=' '/[CROP]/{f=$2} END{print f}' ./mplayer.tmp |cut -d')' -f1) | |
# print detected crop values | |
echo -e "nnDetected crop values = ${CROP_VALUES}nn" | |
mencoder dvd://1 -dvd-device "$bn" -vf crop=${CROP_VALUES} -ovc xvid -xvidencopts bvhq=1:chroma_opt:quant_type=mpeg:bitrate=${VBR}:pass=1 -oac copy -o /dev/null | |
mencoder dvd://1 -dvd-device "$bn" -vf crop=${CROP_VALUES} -ovc xvid -xvidencopts bvhq=1:chroma_opt:quant_type=mpeg:bitrate=${VBR}:pass=2 -alang en -oac mp3lame | |
-lameopts br=${ABR}:cbr:vol=0 -o "${NameNoExt}.avi" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment