Hi8 Tape to DVD Video Workflow

Many individuals and companies own extensive libraries of original analog video recordings. Not only is digitization necessary before such recordings can be used in a digital workflow, but digitization may also be the only way to preserve historically significant recordings for the future. Ideally, a digital copy should be made in a format that alows for convenient archiving and editing while at the same time faithfully preserving the video quality of the original analog source.

Suppose, for example, you've got a bunch of video tapes and a camcorder that is getting old. Before the camcorder breaks you want to make a digital archive from the original source. You can

  1. buy a stand-alone DVD recorder, or
  2. digitize the video using Linux.
It is shocking how poor the resulting video quality of the first option can be. Some DVD recorders even create badly multiplexed video streams that stutter on certain DVD players. This page explains how to use Linux to digitize the video. The Linux method will lead to better results because it enables the use of non-realtime digital filtering and restoration techniques along with a high-quality multipass digital encoder. The Linux method is also cheaper.

Capturing the Video

There are a number of ways to get the video into the computer. One way is to use the passthrough feature of a miniDV camcorder or the digital output of a Sony Digital 8 camcorder to convert the Hi8 source to DV which is then sent via firewire to the computer. Alternatively one can use a stand-alone DV capture device like the Canopus ADVC55 or ADVC110. This yields a workflow identical to transferring miniDV tapes to DVDs. One drawback of this method is that the 4:1:1 colorspace of the DV format has to be converted to the 4:2:0 colorspace of the DVD format which results in further reducing your color resolution. Another disadvantage would be the price of hardware which is typically between 150 and 300 dollars.

Another way to capture the Hi8 tape is a hardware mpeg2 encoder. This will result in video quality similar to a DVD recorder. Since the capture is already mpeg format, it can be written directly to the DVD without additional encoding. Remultiplexing may be necessary. In this case use avidemux2_gtk in copy mode to create a DVD PS format file. Now skip down to Making the Chapters below.

Surprisingly, the method which can obtain the best quality is also the cheapest. Use an analog video capture card to tranfer the Hi8 tapes from the camcorder through S-video cable into the computer. The capture is stored in an uncompressed or high bandwidth intermediate format, then digitally filtered and encoded using a high quality digital encoder. Digital filtering improves the encoding quality of analog sources, but is too slow to do during video capture.

I originally developed this workflow using a dual processor PIII 650Mhz system and a video capture card based on the Philips saa7134 chipset. Connect your camcorder with S-video. A composite video connection can also be used, but will not result in best quality. Then plug the camcorder sound output into the line-input of the sound card.

I have also used a Conexant cx8800 based capture card. The cx8800 had to be set to contrast 22% and brightness 62% to yield correct levels of the NTSC colorbars, whereas the saa7134 yielded correct levels with brightness 50% and contrast at 62%. After calibration it appeared to me that the saa7134 provided a sharper image. However, I have not carefully verified this.

Use aumix to set the sound recording gain on the sound card. The VU meters in audacity or Cinelerra can be used to set verify correct recording levels. Now close audacity or Cinelerra and use xawtv to tune in the video on the video capture card. Then close xawtv.

Use streamer to capture the video. This program is multi-threaded and is the only option on a dual processor PIII 650Mhz system that doesn't drop frames. A suitable command line is

$ streamer -q -p3 -b64 -iS-Video -nntsc \
    -r29.97 -s640x480 -fjpeg -j85 \
    -Fstereo -t2:05:00 -o video.mov
Note that I've chosen to use three threads even though there are only 2 CPUs in the system. If you have a single CPU you may want to use -p2 or -p1 instead. If your machine and video capture card supports it you may specify -s720x480 so there is no rescaling during the final encoding. The capture will end after running for 2 hours and 5 minutes, slightly longer than the length of a full Hi8 tape.

If you have a faster system you may want to consider capturing using the DV50 codec using a 4:2:2 color space. In order to do this, libng from the xawtv project needs to be patched to recognize the dv50 codec. Using dv50 as the capture codec really allows the Linux solution to surpass a stand-along DVD recorder.

It is also possible to capture the video using ffmpeg or lavrec.

Encoding the Video

The video.mov file needs to be encoded into an mpeg file. This can be done with ffmpeg, mjpegtools or mencoder. I think that mpeg2enc from mjpegtools gives the best results. Since this is an analog video source, it is important to filter it. Filtering combined with multi-pass variable-bit-rate software encoding yields better quality video than obtained with a DVD recorder or hardware mpeg2 encoder. For reference, filtering and encoding takes about 10 hours for two hours of video on a PIII server with dual 650Mhz CPUs.

Don't deinterlace. That throws away half the video signal. The only reason to deinterlace when archiving a tape is to save space. For example, if you are compressing 4 hours of video to fit onto a single layer DVD. Interlaced video looks awful on a computer screen, but works fine on a standard DVD player connected to a television.

Make sure you have the interlacing order correct. The choices are top field first or bottom field first. My experience has been that DV video is interlaced bottom field first and nearly everything else is top field first. A procedure for determining the interlacing order is given in Checking Interlacing Flags with Linux. Commands to encode source that is interlaced top field first are

$ lav2wav video.mov >video.wav
$ sox -V video.wav -r48000 video-48.wav
$ toolame -b 224 -s48 video-48.wav video.m2a
$ lav2yuv video.mov |
    yuvcorrect -T INTERLACED_TOP_FIRST |
    yuvscaler -nn -O SIZE_704x480 |
    yuvdenoise -g 0,0,0 -t 8,12,12 -M 0,0,0 |
    mpeg2enc -M0 -nn -a2 -f8 -G18 -b7000 \
            -V230 -q8 -o video.m2v
$ mplex -f8 video.m2v video.m2a -o video.mpg
To encode source that is interlaced bottom field first, replace INTERLACED_TOP_FIRST in the above set of commands by INTERLACED_BOTTOM_FIRST. Also, if your source in 720x480 rather than 640x480 or 704x480 then set the yuvscaler output to -O DVD.

Occasionally there is a error in the variable bitrate control in mpeg2enc that leads to a buffer underflow which is detected during the multiplexing stage. If there are more than 10 such underflows, then mplex will abort with an error.

Buffer underflows cause a DVD to stutter and pause during playback; however, there are times when it is appropriate to ignore buffer underflows and multiplex the files anyway. For example, older camcorders will play the unrecorded parts of a tape as random noise or snow. Random noise is difficult to compress and may cause a buffer underflow. To multiplex a video stream with multiple buffer underflows use the command

$ mencoder video.m2v -audiofile video.m2a \
    -oac copy -ovc copy -of mpeg \
    -mpegopts format=dvd:tsaf:vaspect=4/3 -o video.mpg

Making Chapters

Now, for each video file use avidemux2_gtk to choose chapter breakpoints and snapshots. Start avidemux2_gtk and then click on File->Open to load the video file. Write the times of the chapter breakpoints into the xml file for dvdauthor. For example, a vob entry might look like
    <vob file="video.mpg"
chapters="0,2:38,4:51,8:38,9:42,10:55,11:50,12:45,15:13,16:10,17:54,18:01,23:10,24:45" />
Save the snapshots using File->Save->Save JPEG Image.... Give each snapshot a name that corresponds to the chapter numbers as ch-01.jpg, ch-02.jpg, ch-03.jpg, so things don't get mixed up.

Making the Menus and Cover

Use the scripts
snap2menu and mkstill-dvd to create a sequence of menus containing the screenshots. Fancier menus can be hand crafted with Gimp but there is no need for a tape archive DVD.
$ snap2menu ch-??.jpg
$ mkstill-dvd menu-1.png
$ mkstill-dvd menu-2.png
Next load Gimp with the snapshots and paste them together to make a nice cover. A 720x480 snapshot should be deinterlaced and rescaled to 640x480 before being used on the cover. Paste the most interesting snapshots together along with a date the video was shot and the label of the original source tape archived on the DVD. Note the cover's for CD cases are 5.5"x4.75" and the covers for DVD cases are 10.75"x7.25". I save my covers as 300dpi .png files and place a copy of the file on the DVD in a folder named EXTRA.

Authoring the DVD

Use dvdauthor to author the dvd. A typical xml description for a disk is something like
<dvdauthor>
    <vmgm>
        <menus>
            <video aspect="4:3" />
            <pgc entry="title">
                <vob file="splash.mpg" />
                <post>jump titleset 1 menu;</post>
            </pgc>
        </menus>
    </vmgm>
    <titleset>
        <menus>
            <video aspect="4:3" />
            <pgc entry="root">
                <vob file="menu-1.mpg" />
                <button>jump title 1 chapter 1;</button>
                <button>jump title 1 chapter 2;</button>
                <button>jump title 1 chapter 3;</button>
                <button>jump title 1 chapter 4;</button>
                <button>jump title 1 chapter 5;</button>
                <button>jump title 1 chapter 6;</button>
                <button>jump title 1 chapter 7;</button>
                <button>jump title 1 chapter 8;</button>
                <button>jump title 1 chapter 9;</button>
                <button>jump menu 2;</button>
            </pgc>
            <pgc>
                <vob file="menu-2.mpg" />
                <button>jump title 1 chapter 10;</button>
                <button>jump title 1 chapter 11;</button>
                <button>jump title 1 chapter 12;</button>
                <button>jump title 1 chapter 13;</button>
                <button>jump title 1 chapter 14;</button>
                <button>jump menu 1;</button>
            </pgc>
        </menus>
        <titles>
            <video aspect="4:3" />
            <pgc>
                <vob file="video.mpg"
chapters="0,2:38,4:51,8:38,9:42,10:55,11:50,12:45,15:13,16:10,17:54,18:01,23:10,24:45" />
                <post>call menu;</post>
            </pgc>
        </titles>
    </titleset>
</dvdauthor>
Save the above into the file dvd.xml and then author the disk with
$ dvdauthor -o disk1 -x dvd.xml

Burning the DVD

Check the DVD to make sure the menus work with the command
$ vlc disk1/
If you need to change the xml file and rerun dvdauthor first remove the output directory with
$ rm -r disk1
and run dvdauthor -o disk1 -x dvd.xml again. Please make sure you know what the -r option means in the above rm command before you use it, because it is surprisingly easy to erase every single file in your account with this option. When you are satisfied type
$ growisofs -dvd-compat -dvd-video -Z/dev/dvd disk1
to burn the DVD.

Further Notes

Note that home made DVDs are significantly less durable than factory made disks. The data on a recordable DVD is stored by means of a laser reactive dye that can fade over time. Different blank media use different dyes with different aging characteristics. There have been a number of reports of recordable DVDs that are unplayable after only 2 to 5 years. For best results use achival quality DVDs, don't write on them with permanent markers and follow the NIST guildelines on Care and Handling of CDs and DVDs.

Keep the old tapes. In 20 years it is not obvious which format will still be playable. Additional information on archiving digital video may be found at How to Archive AVCHD Video.

Also note that Linux can be used to fix DVDs created with a hardware DVD recorders that don't multiplex the VOB files properly. Briefly, these DVDs can be fixed in Linux by ripping the VOB files, remultiplexing them with avidemux2_gtk in copy mode and then rewriting them to a new DVD using DVD author.


Last Updated: Wed Dec 12 21:14:51 PST 2012