garok89
July 21st, 2008, 11:11 PM
iv only switched to ubuntu less than a month ago and decided to have a go at writing a script as no matter wat program i used to rip dvds, it would not work or take an excessive amount of time
after searching i came across a script here (http://quadpoint.org/projects/simplerip):
http://quadpoint.org/projects/simplerip
and modified it to ask for settings etc....
being my 1st attempt at writing in sh, i was unsure how to include the option to specify deinterlacing and PAL or NTSC standards. this wasnt helped by how vague the section on this was....
and advice would be greatly appreciated (even the option to specify output directory or different codecs).
thanks
#!/bin/bash
#This script is for ripping DVD-Videos to Xvid
#Asks User for name of file
echo "Please type the name of the movie you would like to rip (no spaces)"
read MovieTitle
#Makes directory for output
mkdir ~/Desktop/RippedDVDs/
mkdir ~/Desktop/RippedDVDs/$MovieTitle
cd ~/Desktop/RippedDVDs/$MovieTitle
#Asks User for audio bitrate and gain
echo "Please enter audio bitrate (recommended 128)"
read AudioBitrate
echo "Please enter audio gain -10 to +10 (recommended 0)"
read AudioGain
#Asks User for video bitrate and crop details
echo "Please enter video bitrate (recommended 1024)"
read VideoBitrate
echo "Please enter crop (run 'mplayer dvd://1 -vf cropdetect' in seperate terminal and wait for stable output in the form xxx:xxx:xx:x)"
read VideoCrop
#Asks User how many passes
echo "How many passes?
1: faster encoding
2: better quality"
read Passes
# remove conflicting files
rm -f divx2pass.log frameno.avi
# rip audio track (bitrate: $AudioBitrate, gain: $AudioGain)
nice -n 3 mencoder -oac mp3lame -lameopts mode=2:cbr:br=$AudioBitrate:vol=$AudioGain \
-ovc frameno -o frameno.avi dvd://1
if [ "$Passes" = "1" ]
then
# video track (pass: 1, bitrate: $)
nice -n 3 mencoder -sws 2 -oac copy -ovc lavc \
-lavcopts vcodec=mpeg4:vbitrate=$VideoBitrate:vhq \
-ffourcc XVID -vf crop=$VideoCrop dvd://1 -o "$MovieTitle.avi"
else
# video track (pass: 1, bitrate: $VideoBitrate)
nice -n 3 mencoder -sws 2 -oac copy -ovc lavc \
-lavcopts vcodec=mpeg4:vbitrate=$VideoBitrate:vhq:vpass=1 \
-ffourcc XVID -vf crop=$VideoCrop dvd://1 -o "$MovieTitle.avi"
# video track (pass: 2, bitrate: $VideoBitrate)
nice -n 3 mencoder -sws 2 -oac copy -ovc lavc \
-lavcopts vcodec=mpeg4:vbitrate=$VideoBitrate:vhq:vpass=2 \
-ffourcc XVID -vf crop=$VideoCrop dvd://1 -o "$MovieTitle.avi"
fi
echo "Process complete. Thank You. Please press Enter to exit"
read End
#done
ps. did i put this in the wrong section???
after searching i came across a script here (http://quadpoint.org/projects/simplerip):
http://quadpoint.org/projects/simplerip
and modified it to ask for settings etc....
being my 1st attempt at writing in sh, i was unsure how to include the option to specify deinterlacing and PAL or NTSC standards. this wasnt helped by how vague the section on this was....
and advice would be greatly appreciated (even the option to specify output directory or different codecs).
thanks
#!/bin/bash
#This script is for ripping DVD-Videos to Xvid
#Asks User for name of file
echo "Please type the name of the movie you would like to rip (no spaces)"
read MovieTitle
#Makes directory for output
mkdir ~/Desktop/RippedDVDs/
mkdir ~/Desktop/RippedDVDs/$MovieTitle
cd ~/Desktop/RippedDVDs/$MovieTitle
#Asks User for audio bitrate and gain
echo "Please enter audio bitrate (recommended 128)"
read AudioBitrate
echo "Please enter audio gain -10 to +10 (recommended 0)"
read AudioGain
#Asks User for video bitrate and crop details
echo "Please enter video bitrate (recommended 1024)"
read VideoBitrate
echo "Please enter crop (run 'mplayer dvd://1 -vf cropdetect' in seperate terminal and wait for stable output in the form xxx:xxx:xx:x)"
read VideoCrop
#Asks User how many passes
echo "How many passes?
1: faster encoding
2: better quality"
read Passes
# remove conflicting files
rm -f divx2pass.log frameno.avi
# rip audio track (bitrate: $AudioBitrate, gain: $AudioGain)
nice -n 3 mencoder -oac mp3lame -lameopts mode=2:cbr:br=$AudioBitrate:vol=$AudioGain \
-ovc frameno -o frameno.avi dvd://1
if [ "$Passes" = "1" ]
then
# video track (pass: 1, bitrate: $)
nice -n 3 mencoder -sws 2 -oac copy -ovc lavc \
-lavcopts vcodec=mpeg4:vbitrate=$VideoBitrate:vhq \
-ffourcc XVID -vf crop=$VideoCrop dvd://1 -o "$MovieTitle.avi"
else
# video track (pass: 1, bitrate: $VideoBitrate)
nice -n 3 mencoder -sws 2 -oac copy -ovc lavc \
-lavcopts vcodec=mpeg4:vbitrate=$VideoBitrate:vhq:vpass=1 \
-ffourcc XVID -vf crop=$VideoCrop dvd://1 -o "$MovieTitle.avi"
# video track (pass: 2, bitrate: $VideoBitrate)
nice -n 3 mencoder -sws 2 -oac copy -ovc lavc \
-lavcopts vcodec=mpeg4:vbitrate=$VideoBitrate:vhq:vpass=2 \
-ffourcc XVID -vf crop=$VideoCrop dvd://1 -o "$MovieTitle.avi"
fi
echo "Process complete. Thank You. Please press Enter to exit"
read End
#done
ps. did i put this in the wrong section???