4/13/2005

How To Copy A Video DVD

Below is a python script I wrote to make a copy of a video DVD and burn it onto a writable DVD. This is a more complicated process than copying an audio CD because manufactured DVDs can hold around 8.5 gigabytes (GB) of data while your blank writable DVD can usually only hold 4.7 GB. So, this script goes through the process of taking the movie tract, decrypting it, separating out the video and audio, compressing the video as needed, combining the result back together, and burning it onto the blank DVD. I can’t tell any difference between the original and the copy, besides all the “extras” missing, so it works out well.

This script runs under Linux and requires python, vobcopy, libdvdcss, mjpegtools, transcode, dvdauthor, and dvd+rw-tools. Only use this script to copy DVDs you legally own for your personal use or else the MPAA will saw off your hands with a rusty butter knife. You have been warned!


#!/usr/bin/python

####
# Author: Chris Ladd
# File: copydvd.py
# Date: April 13, 2005
# License: GPL v2
####

import os;

# Change this to point to your DVD burner
DVD_BURNER = "/dev/hdb"

# Make sure we have a clean environment
os.chdir("/tmp")
os.system("rm -f *.vob")
os.system("rm -f *.vob.partial")
os.system("rm -f movie.m2v")
os.system("rm -f movie.ac3")
os.system("rm -f shrink.m2v")
os.system("rm -f movie*.mpg")
os.system("rm -f toc.xml")
os.system("rm -rf movie/")

# Copy the dvd movie track
assert os.system("vobcopy -l") == 0
assert os.system("mv *.vob movie.vob") == 0

# Separate the audio and video
assert os.system("tcextract -i movie.vob -t vob -x mpeg2 > movie.m2v") == 0
assert os.system("tcextract -i movie.vob -t vob -x ac3 -a 0 > movie.ac3") == 0

# Calculate how much we have to shrink the video
m2v_size = float(os.stat("movie.m2v")[6])
ac3_size = float(os.stat("movie.ac3")[6])
print "m2v size: %f" % m2v_size
print "ac3 size: %f" % ac3_size

factor = float(m2v_size / (4700000000.0 - ac3_size) * 1.02)
factor = round(factor, 2)
print "shrink factor: %f" % factor

# Shrink the video if necessary and put it back together with the audio
if factor > 1.0 :
    assert os.system("tcrequant -i movie.m2v -o shrink.m2v -f %f" % factor) == 0
    assert os.system("mplex -f 8 -o movie%d.mpg shrink.m2v movie.ac3") == 0
else :
    assert os.system("mplex -f 8 -o movie%d.mpg movie.m2v movie.ac3") == 0

# Write the DVD TOC so that the video starts playing once inserted
toc = open("toc.xml", "w")
toc.write('<dvdauthor>n  <vmgm />n  <titleset>n   <titles>n    <pgc>n')
for filename in os.popen("ls movie*.mpg") :
    toc.write('      <vob file="%s" />n' % filename[:-1])
toc.write('    </pgc>n   </titles>n  </titleset>n </dvdauthor>')
toc.close()

# Create the DVD image
assert os.system("dvdauthor -o movie -x toc.xml") == 0

# Burn the new DVD
assert os.system("growisofs -Z %s -dvd-video movie/" % DVD_BURNER) == 0

# Clean up
os.system("rm -f *.vob")
os.system("rm -f movie.m2v")
os.system("rm -f movie.ac3")
os.system("rm -f shrink.m2v")
os.system("rm -f movie*.mpg")
os.system("rm -f toc.xml")
os.system("rm -rf movie/")

4/23/2005

Aaron Kincaid and Melinda Marcellus Wedding

This wedding between two of my best friends was a truly magical affair. The setting was the wonderful wilderness on the outskirts of Yosemite Park filled with majestic pine trees and all the glory of nature. The ceremony was very touching, with Aaron’s step-dad performing the service and the couple reciting their hand written vows. Melinda looked gorgeous in her wedding gown and Aaron didn’t look too bad either.

The reception took place in the restaurant at the hotel and was filled with family and friends. I got to see all my friends who have spread out to different cities since college and, as you can see in the photos, we had a great time. Congratulations Aaron and Mel!

5/7/2005

Little Monsters

We are spending a long weekend in San Diego in order to taste test the food for our wedding reception. We spent today hanging out with Aliciana’s family and trying to remain sane while dealing with her nephews. Their amount of energy never ceases to amaze me. It is quite a shock to your system when you go from hanging out in a nice quite apartment at home to being surrounded by 4 little children who are screaming, running around, causing trouble, and using your body as a jungle gym. I had lots of fun with them once I adjusted… but I am glad I don’t have to deal with this level of noise all the time.

5/9/2005

Reception Banquet Room

After tasting the food that we are going to serve at our wedding reception we took a look at the banquet room the event is going to take place in. The first photo located below is of the the center piece that will be on all the tables. The next 3 photos are of the actual banquet room, which was setup for an event taking place later in the day. The last photo is of the patio that guests will be able to hang out on until the banquet room doors are open at 6:00 pm for the reception. That patio is also ours to use as the evening events go on until midnight (maybe even 1:00 am if anyone can make it that long).

5/23/2005

Crazy Bird Identified

Yesterday, while in the local Barnes & Noble killing some time before lunch, I finally remembered to look up what type of bird this is:

It turns out to be a “Green Heron”, so now I have a type to put with the bird. I have seem him a lot lately, usually fishing for crawfish in the pond by my apartment. He is quite fun to watch because his actions seem quite erratic to us humans, hence the name “Crazy Bird”. More info on his species can be found here.

6/4/2005

San Diego Bridal Shower

Aliciana went down to San Diego for a bridal shower thrown by her mom. She left Saturday morning early and only stayed in town for about 36 hours. Below are some photos taken before the shower.

6/5/2005

Beautiful Hair

Before leaving town Aliciana had Jenny’s mom do I trial run on her hair. She will be doing Aliciana’s hair the morning of the wedding. I think it turned out very beautiful… I was blown away when I saw her later on in the day in person. Jenny’s mom is very talented!

6/5/2005

Nokia 770: Who wants to buy me one?

Nokia 770 Internet TabletA few days ago Nokia and several Gnome Project related companies announced the Nokia 770 Internet Tablet. The device is only 5.5 x 3.1 inches in dimension and 0.75 inches thick, making it about the size of your typical PDA. It includa a 800×480 touch screen in full color, 802.11 b/g WIFI, and a nice brushed metal case. But, the best part about this device, is that it runs Linux and Gnome!!! Nokia has even completely open sourced all the software on the device and is supporting it as a community project called maemo.

The device is expected to go on sale within the next few months and cost $350. Anyone want to buy me one so I can start hacking on it? With such an open platform, the possibilities for this device are limitless. Lots more information about this device can be found on Nokia’s web site.

6/11/2005

Congratulations Nick And Jessie

We spent all weekend in San Luis Obispo celebrating Nick and Jessie’s graduation from Cal Poly. Below are my pathetic attempts to take photos from the nose bleed section of the gym their ceremony was held in. The organization of the ceremony seemed pretty bad considering there wasn’t even enough chairs on the court for all the graduates to have a seat. I guess architects leave implementation details like that to us engineers 😉

6/28/2005

First Day Of Work

Today was my first day of work at my new job as a Web Systems Analyst at The Bakersfield Californian. I will be working on web related projects and doing other software development as needed. Everyone at the paper has been great and the work environment is awesome. Everyone is really open to my ideas and my suggestions seem to be genuinely valued. There is no shortage of interesting ideas being kicked around as future projects, so I am really looking forward to the coming opportunities to apply my skills. I also get to run Linux at work, which is a big plus!