Created
April 6, 2012 17:19
-
-
Save lwhsu/2321460 to your computer and use it in GitHub Desktop.
This file contains 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/sh | |
ISO=$1 | |
OUTFILE=$2 | |
TITLE=1 | |
CHAPTER=1 | |
VBITRATE=512 | |
ABITRATE=64 | |
TIMESTAMP=${OUTFILE}.timestamp | |
touch ${TIMESTAMP} | |
echo `date` " Video Pass 1" | tee -a ${TIMESTAMP} | |
mencoder dvd://${TITLE} -dvd-device ${ISO} -chapter ${CHAPTER} \ | |
-ovc x264 -nosound -vf pullup,softskip,harddup \ | |
-x264encopts pass=1:bitrate=${VBITRATE}:me=hex:level_idc=21:keyint=250:frameref=1:bframes=0:nocabac:threads=auto:turbo=2 \ | |
-o /dev/null | |
echo `date` " Video Pass 2" | tee -a ${TIMESTAMP} | |
mencoder dvd://${TITLE} -dvd-device ${ISO} -chapter ${CHAPTER} \ | |
-ovc x264 -nosound -vf pullup,softskip,harddup \ | |
-x264encopts pass=2:bitrate=${VBITRATE}:me=hex:level_idc=21:keyint=250:frameref=1:bframes=0:nocabac:threads=auto \ | |
-o video.mp4 | |
#echo `date` " Audio Dump" | tee -a ${TIMESTAMP} | |
#Set the channel parameter to how many channels the audio source has. (6 channels for 5.1 surround, 2 for stereo sound) | |
#mplayer dvd://${TITLE} -dvd-device ${ISO} -chapter ${CHAPTER} -aid 128 -vc dummy -vo null -ao pcm -channels 2 | |
echo `date` " Audio Dump" | tee -a ${TIMESTAMP} | |
mplayer dvd://${TITLE} -dvd-device ${ISO} -chapter ${CHAPTER} \ | |
-dumpaudio | |
echo `date` " Audio Convert to PCM" | tee -a ${TIMESTAMP} | |
mplayer -vc null -vo null -ao pcm -channels 2 stream.dump | |
echo `date` " Audio Compress" | tee -a ${TIMESTAMP} | |
#Again change the "-C" parameter to how many channels your audio dump has. | |
faac -b ${ABITRATE} -q 100 -R 48000 -C 2 -X audiodump.wav -o audio.mp4 | |
echo `date` " Merge MP4" | tee -a ${TIMESTAMP} | |
ffmpeg -i video.mp4 -i audio.mp4 -vcodec copy -acodec copy ${OUTFILE}.mp4 | |
rm -f audio.mp4 audiodump.wav divx2pass.log divx2pass.log.mbtree stream.dump video.mp4 | |
echo `date` " Finish" | tee -a ${TIMESTAMP} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment