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
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 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.movNote 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.
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.mpgTo 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
<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.
$ snap2menu ch-??.jpg $ mkstill-dvd menu-1.png $ mkstill-dvd menu-2.pngNext 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.
<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
$ vlc disk1/If you need to change the xml file and rerun dvdauthor first remove the output directory with
$ rm -r disk1and 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 disk1to burn the DVD.
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.