View unanswered posts    View active topics

All times are UTC - 6 hours

Post new topic Reply to topic  [ 1 post ] 
Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Sun Dec 05, 2010 11:23 pm 
Joined: Sun Nov 12, 2006 3:15 pm
Posts: 21
I really enjoyed the DVD Import function but it was becoming old technology. My DVDs were archived in XviD and avi. I prefer x264 and mkv. I was also having issues archiving some of my DVDs with the bad track issues. I tried using dvdbackup but still had problems with the bad track issue. I was able to use vobcopy to make it do what I wanted. Here is what I did and the script I used.

First install make.
sudo pacman -S make
Then download vobcopy from
tar -zxvf vobcopy-1.1.2.tar.gz
cd vobcopy-1.1.2
sudo make install

I then coaxed my son to help me write the script. Two liters of Mountain Dew and two boxes of Oreos later this is what we had.

#Usage <MovieName>

# Checks for stupidity
if [[ -z $1 ]]; then
   echo "Please enter the movie name."

# Creates temporary directory and moves there
mkdir /myth/tmp/DVD
cd /myth/tmp/DVD

# Copies the main track video and audio file from the DVD
# while checking for bad tracks
while [ $ERROR -ne 0 ]; do
   UNITS="m"     # b=bytes, k=kilobytes, m=megabytes, g=gigabytes
   /usr/local/bin/vobcopy -f -b ${BADTRACK} -F 64 -l -i /dev/dvd
   rm *.partial 2>/dev/null   # since the vobcopy -x switch doesn't work
   if [ $i -eq 50 ]; then
      echo "Too many bad tracks."
   let "i++"

# Rename file because vobcopy -t switch doesn't work
OLDNAME=`ls *.vob`
mv "$OLDNAME" "$NAME.vob"

# copies original track 1 audio file
nice -n19 mplayer "$NAME.vob" -aid 128 -dumpaudio -dumpfile "$NAME.ac3"

# Re-encodes the video file to X264
nice -n19 mencoder "$NAME.vob" -passlogfile TWOPASSFILE -ofps 24000/1001 -vf lavcdeint,scale=720:-3 -oac copy -ovc x264 -x264encopts threads=auto:pass=1:turbo=1:subq=1:frameref=1:bframes=3:bitrate=1000 -of rawvideo -o /dev/null
nice -n19 mencoder "$NAME.vob" -passlogfile TWOPASSFILE -ofps 24000/1001 -vf lavcdeint,scale=720:-3 -oac copy -ovc x264 -x264encopts threads=auto:pass=2:subq=5:8x8dct:frameref=3:bframes=3:b_pyramid:weight_b:bitrate=1000 -of rawvideo -o "$NAME.264"
rm "$NAME.vob"

# Moves the re-encoded video file into a mp4 container
MP4Box -add "$NAME.264" -fps 23.976023976 "$NAME.mp4"
rm "$NAME.264"

# Joins the video from the mp4 container with the original audio
mkvmerge -o "$NAME.mkv" -A "$NAME.mp4" "$NAME.ac3"

# Moves the mkv file to the archive folder and deletes the temp folder
mv "$NAME.mkv" "/myth/video/archive/$NAME.mkv"
cd /home/mythtv
rm -R /myth/tmp/DVD

The script seems to work well on my system. It has even archived some of my more difficult DVDs. There are a few things to be careful of if you use it. The first is I'm not a coder. I really don't have a clue. Also the -l switch in vobcopy is for hard drive partitions that support files greater than 4 gig. Make sure you have such a partition. I'm using ext4. This sequence requires a lot of hard drive space. It can use up to 20 gig. Also vobcopy is not fast. I used the -F 64 switch and it helped speed it up but it's not fast. I also ran into troubles getting vobcopy to see my dvd. So I used the -i /dev/dvd switch. It is definitely not the way to do it but it works. That may just be a issue on my machine. The mencoder setting are from brfransen's great script myth2x264. The script works in the /myth/tmp directory and transfers the end product to the /myth/video archive directory. The script I run from the /home/mythtv directory.

My system is a LINHES 6.03 box with a MSI 890 board and a X2 Phenom with all 4 cores unlocked and 2 gig of memory. This scripts runs on it without and issue so far.


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 1 guest

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:  
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu