Linux and DVD-RAM Digital Video Recorders

This page describes the procedure for moving video from the video recorder DVD-RAM discs to a Linux computer, and then burning standard DVD-R discs for use in a standard DVD player. You will need a drive that can read DVD-RAM discs.

I used to edit out the commercials using the DVR's GUI, but then I discovered that it cheated and didn't do frame-by-frame cuts, it went to the next Group-Of-Pictures and saved frame cuts in the info file and just didn't play those back. This avoided the need for the DVR to re-encode anything, avoided loss of quality and kept the GUI fast, but then left these orphan chunks in the file which appear in any DVDs you try to make.

Avidemux seems to be fairly decent for a video editor, so I use that.

You need these packages in Debian:


Removing commercials from the recorded video

Mount the DVD-RAM disc and copy the VR_MOVIE.VRO file to your hard disk. The filesystem type is "udf" and you may need to recompile your kernel to add support for this filesystem. This VR_MOVIE.VRO file appears to be a plain MPEG2 PS stream file, but it's already in DVD-compliant form, so you can use the "Copy" video codec. Open it in avidemux, and select the "MPEG PS A+V" format.

Note that this takes a LOT of disk space. It's usually about 14G to create one DVD. This includes the original file, the edited copy, the final ISO-9660 master, the DVD file structure, title files, and the index that avidemux2 creates for the MPEG editing.

I remove commercials from my race videos by saving each video segment as a separate chapter file. This avoids artifacts between commercial cuts on playback.

NOTE: you must start each video segment on a key frame, using the "Next Keyframe" avidemux2 button icon and "Previous Keyframe" avidemux2 button icon buttons. Turn on "NumLock" and you can also use "8" and "2" on the numeric keypad.

You need to go into Edit -> Preferences -> Automation and make sure that "Automatically swap A and B if A>B" is unchecked, otherwise it can screw up your edit marks.

Here's how I do it.:

  1. Use the "Next Keyframe" avidemux2 button icon button (or numeric keypad "8") and the "Previous Keyframe" avidemux2 button icon button (or numeric keypad "2") to find the best start.
  2. Hit the "Selection: Start" avidemux2 button icon button or the "[" key.
  3. Hold down the "8" key on the numeric keypad and let it autorepeat to scan to beginning of next commercial break.
  4. Use "8" and "2" to find a black frame.
  5. Hit the "Selection: End" avidemux2 button icon button or the "]" key.
  6. Hit Ctrl-S to save this chapter, and save as "chap01.mpg" (or whatever number is appropriate)
  7. Use "8" and "2" to scan to find the black frame at the end of the commercial break. This gives a nice fade-in.
  8. Start over at step #2 until you've processed the entire file.

This works for pretty much everything, and is faster on my machine than the previous method of scanning for "next black frame".


Creating a simple title leader

In GIMP, create a new 704x480 image. I use white lettering on a black background, listing the race, track, country, and date. I'm not very artistic. Save this as a PPM file, such as "title.ppm". ppmtoy4m is much smarter than jpeg2yuv.

Convert the PPM to MPEG2 PS video stream:

-n 187 Specifies 187 frames of video, which matches my 6 seconds of AC3 audio. You should try to make them match to avoid confusing cheap players. If the audio is short, my XBOX gets confused and attempts to start playing the audio from the next chapter too soon. The Panasonic DVR that recorded the original DVD-RAM plays things just fine, but you can't depend on everyone's player being well-behaved.
-S 420mpeg2 Makes mpeg2enc happy.
-a 2 Explicitly sets the aspect ratio to stop complaints about "unknown aspect ratio" from dvdauthor.
-n n Specifies NTSC video.
-f 8 Specifies DVD format.

You must have audio, so you need a short length of silence. This needs to be Dolby A/52 (aka AC-3) standard, which I don't know how to make in Linux, so I use a Windows tool to create it. I created the file to be 6 seconds long, and I keep it around for reuse.

ppmtoy4m -S 420mpeg2 -n 187 -I p -r title.ppm | mpeg2enc -n n -a 2 -f 8 -o title.m2v
mplex -f 8 title.m2v ~/silence-6sec.ac3 -o title.mpg

You now have a short "chapter" you can include in the beginning of the DVD as a title.


Assembling the DVD structure and burning it to disk

We're in the home stretch. We will assume that /dev/dvd is the device for your DVD writer. Make the DVD image and table of contents, create an ISO-9660 master from that, then burn it to disc:

mkdir disk
dvdauthor -o disk title.mpg edited.mpg
dvdauthor -o disk -T
mkisofs -dvd-video -o dvd-master.iso disk
growisofs -dvd-compat -Z /dev/dvd=dvd-master.iso

That's it! We're done. Stick a fork in it. I've written a mkdvd script to do everything necessary after the "title.ppm" and "edited.mpg" files are created.

Valid HTML 4.01 Transitional