Register
It is currently Thu Apr 17, 2014 10:09 pm

BashDVDriPPer


All times are UTC - 6 hours


Post new topic Reply to topic  [ 1 post ] 
Author Message
 PostPosted: Tue Mar 30, 2010 10:53 pm   

Joined: Tue Mar 30, 2010 10:41 pm
Posts: 1
Here is my script for ripping dvd's to h.264. What it does is rip a dvd into the H.264 encoder at the specifiesd bit rate; it even crops the video for you to eliminate black borders. It beats trying to get Acidrip to work. This is my simple alternative to acidrip. It uses lsdvd, mencoder, mplayer, libdvdcss and x264. Mencoder must support encoding in H.264...you must have x264 installed. just run it without options and it'll show you want to enter and in which order to enter them. Let me know what you guys think.

#!/bin/bash
DEVICE="$1"
NAME="$2"
BITRATE="$3"
AID="$4"
TITLE="$5"

if [[ $# != "5" ]]; then
echo -e "\n You are missing options \n"
echo -e "\n Syntax: rip.sh DVD_DEVICE NAME BITRATE AID TITLE(S) \n"
exit 0
else
echo -e "\n All options seem sufficient \n"
echo -e "\n rip.sh $DEVICE $NAME $BITRATE $AID $TITLE \n"
fi

mkdir ${HOME}/Ripping/${NAME} && echo -e "\n Successfully created directory for ${NAME} under ${HOME} \n"
cd ${HOME}/Ripping/${NAME} && echo -e "\n Successfully changed to ${NAME} under ${HOME} \n"

function crop()
{
if echo $TITLE | grep \-; then
mplayer dvd://${FIRST_TITLE} -dvd-device ${DEVICE} -frames 4000 -vf cropdetect > crop.txt
CROP=`cat crop.txt |grep -w crop | cut -d"=" -f2 | sed s/..$/""/ |tail -n1`
rm crop.txt
else
mplayer dvd://${TITLE} -dvd-device ${DEVICE} -frames 4000 -vf cropdetect > crop.txt
CROP=`cat crop.txt |grep -w crop | cut -d"=" -f2 | sed s/..$/""/ | tail -n1`
rm crop.txt
fi
}

function riptitles()
{
FIRST_TITLE=`echo ${TITLE} |grep \- | sed s/..$/""/ |cut -d"-" -f1`
LAST_TITLE=`echo ${TITLE} |grep \- | sed s/^../""/ |cut -d"-" -f2`
for i in `seq ${FIRST_TITLE} ${LAST_TITLE}`; do
mplayer -dvd-device ${DEVICE} dvd://${i} -dumpstream -dumpfile ${NAME}${i}.vob
done

for ((i=${FIRST_TITLE}; i<=${LAST_TITLE}; i++)); do
mencoder ${NAME}${i}.vob -aid ${AID} -vf crop=${CROP} -ovc x264 -x264encopts bitrate=${BITRATE}:threads=2:subq=3:partitions=all:me=umh:frameref=3:bframes=2:weight_b:pass=1 -oac mp3lame -lameopts br=192 -o /dev/null
mencoder ${NAME}${i}.vob -aid ${AID} -vf crop=${CROP} -ovc x264 -x264encopts bitrate=${BITRATE}:threads=2:subq=5:partitions=all:me=umh:frameref=4:bframes=2:weight_b:pass=2 -oac mp3lame -lameopts br=192 -o ${NAME}_${i}.avi
rm *.log
done
}

function riptitle()
{
mplayer -dvd-device ${DEVICE} dvd://${TITLE} -dumpstream -dumpfile ${NAME}.vob
mencoder ${NAME}${i}.vob -aid ${AID} -vf crop=${CROP} -ovc x264 -x264encopts bitrate=${BITRATE}:threads=2:subq=3:partitions=all:me=umh:frameref=3:bframes=2:weight_b:pass=1 -oac mp3lame -lameopts br=192 -o /dev/null
mencoder ${NAME}${i}.vob -aid ${AID} -vf crop=${CROP} -ovc x264 -x264encopts bitrate=${BITRATE}:threads=2:subq=5:partitions=all:me=umh:frameref=4:bframes=2:weight_b:pass=2 -oac mp3lame -lameopts br=192 -o ${NAME}.avi
rm *.log
}

if echo $TITLE | grep \-; then
crop
riptitles

else
crop
riptitle


fi

exit 0


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP