Saturday, February 07, 2004

Rough Guide to VideoCap


Okay, definitely have the Hauppauge WinTV working properly, with no sound issues or sync issues (yay!). So now I need to figure out the steps required to cap a VHS tape and create a DVD. (For example purposes, I captured (3) MASH episodes.) Gonna write this as I go today, maybe clean it up later and create a permanent page, so there might be some errors here as it's a rough draft.

A. Capture: Capture off tape to MJPEG (Q19) and uncompressed WAV audio (48kHz, 16bit stereo). Eats up around 10Gb per hour (as a planning number), and I'm capturing at 720x480, 29.97fps using VirtualVCR. At least, I think I'm supposed to do 720x480 (other option for DVD is 704x480). Will figure that out once I finally get to the DVD output. Time required to capture and save is around 1.05:1 (close enough to 1:1, extra time is stuff like naming the files, re-arranging things on disk, making sure audio levels are set properly). It's important to make sure that your audio levels aren't clipping (overly loud, which loses the top part of the signal, sounds like frying something in a frying pan). You can almost always fix the audio later to be louder (normalizing the audio), so shoot for around 75-80% peak volumes (roughly 3-10db below maximum).

When capturing video, you should always capture a minute or two prior and after what you're planning on cutting as the final result. So if you want a 50 minute segment in the middle of the tape, start capturing 2 minutes before that segment and let the capture run for a minute or two after that segment. While it takes a little more space later, it's much easier to do cutting/editing in the computer rather then trying to manually time it with the record/stop buttons. For short segments, you may only want to capture 30-60 seconds before and after.

The exception to that rule is that a single capture file should not span across any breaks in the source tape (e.g. if you stopped the recording and then started recording something else). Recording across pauses/breaks in the VCR tape usually results in dropped frames, which might lead to audio-sync issues later. If you have no choice but to capture across a break/pause because there's only a second or two between the break/pause and what you want to capture, then try to minimize the effects by recording as short a period after the break/pause as possible. Such as stopping the capture during the next commercial break or scene change (if the audio goes completely quiet). The longer the clip, the more noticable any audio-sync issues would become.

The MASH episodes resulted in (4) seperate capture files as I stopped/started recording during each commercial break. Sometimes I collect the commercial breaks for later if I see a commercial that might be fun to see 10-20 years from now to remember how things were. With a DVD, I can put the commercials in a seperate menu so that you won't have to watch them unless you want to.

Key points:
- check audio levels, don't compress audio, 48kHz, 16bit, stereo
- video capture resolution of 720x480, saving as MJPEG Q19 (PicVideo codec)
- check disk spaces, 10Gb/hr planning
- 1 hour to capture 1 hour of video
- target is zero dropped frames
- capture more then you need

B. Clean-up Audio: Time to clean up the audio signal. The MASH episodes that I captured were extremely bad. Lots of hiss along with a 60hz hum. Since the non-MASH sections of the captures did not have these artifacts, it's apparent that the fault lies in the original TV transmission and not my capture setup. In addition, I want to make sure that the audio levels are the same (normalized to 90-90%).

First, we need to demux the audio stream which means outputing the audio portion of the captured clips to .WAV files so they can be edited with an audio/wave editor. Open up the AVI files using a fresh instance VirtualDub. Under the Audio menu, verify that Source Audio is selected along with Direct stream copy. Then do File, Save WAV, giving the WAV file the same name as the AVI clip, except with a WAV filename extension. (So if your clip is named "s02e20-capture.avi", call the audio file "s02e20-capture.wav".) This is a fairly quick process, maybe 10 seconds per minute of video, file size is roughly 11Mb/min or 660Mb/hr. Go ahead and export all parts of the episode at the same time.

Open up your audio WAVs in a wave/audio editing program (personally, I use Cool Edit 2000, but Adobe bought them out and I don't know what else is available). The main features that you need is the ability to normalize the audio (or make it louder/softer by a set amount) and noise reduction capabilities. I always to do noise-reduction on the audio signal first. My reasoning is that I'd rather get rid of any noise artifacts prior to making those artifacts louder/softer with normalization.

Cool Edit 2000 has the nice feature where you can build a noise reduction profile from a selected segment of the audio clip. So first I look for a quiet section, where there is no background music, foley effects or dialogue. Zoom in on that section, highlight what looks like a quiet spot and listen to it a few times. You'll need about 0.25-0.50 seconds worth of information for the filter to work properly. Sometimes you can't find a section in one clip, so you'll have to use a profile from another clip; which is why it's a good idea to edit all of your audio clips from a single episode at the same time. Once you have your noise sample selected, go into the Noise Reduction dialog and create the profile from the selected sample. I'd suggest saving out the noise reduction profile to an FFT file in case you ever need to use it again (or with a different clip). To apply the filter to the entire clip, close the dialog, select all (Ctrl-A), re-open the dialog and apply it. Noise reduction will take a bit of time, on my AthlonXP 2600+, it takes around 15-20 seconds to do NR on a 1 minute sample.

Next, if your audio isn't loud enough (it should peak around -3 to -10 dB on the meter), you'll need to do normalization. The tricky part is making sure that you use the same amplification on all of the clips from the same episode. If one of your clips is only quiet bits with no loud noises, and you normalize it, it will end up sounding louder then the other parts of the episode. This is another reason to capture more then you need as hopefully the lead or tail of the captured clip will have full volume dialog/music. If not, you'll have to take a guess and do some trial-n-error. Another alternative is to capture the entire episode as a single clip and then cut it into segments later (downside is increased risk of audio-sync issues when dealing with longer clips). Also be aware that you may need to apply different amplifications to the left vs right audio tracks (sometimes one is louder then the other). Normalization/amplification should go quick, takes around 5-10 seconds per minute of audio on my AthlonXP 2600+.

Once you've cleaned out the noise and fixed the volume levels, take a few minutes to spot check the quality. It should sound remarkably better then the raw source audio did.

Save the WAV files out to new filenames, e.g. "s02e20-capture-cleanedaudio.wav". Save it out as uncompressed PCM (should be the default). Again, count on another 660Mb/hr of disk space for the new audio files (you did buy the really really really big disk, right?).

C. Re-Muxing, Video Clean-up, Cutting: Before you can cut, you need to re-mux the cleaned up audio track back into the AVI file. You may also want to clean up the video a bit to get rid of any artifacts or fix brightness / contrast / color levels. Typically, I only get rid of any top/bottom edge artifacts which result from tracking errors. This can be seen as noise in the top/bottom lines of the frames where the colors are messed up. To remove these errors, I use a "fill" filter where I overlay a black rectangle over the offending lines. If the signal is really noisy, I may attempt to use a smoothing filter to make it easier on the encoder later. Now, for the quick list of steps in VirtualDub:

- open up your AVI, "s02e20-capture.avi"
- Video, Filters, add/remove what you need
- Set your video copy mode, use Normal recompress if you're not using any filters or Full processing mode if you are using filters
- Set your video compression to MJPEG Q19
- Under the audio menu, choose WAV Audio and select your cleaned up WAV file
- Set the audio mode to direct stream copy
- select the portion of the clip that you wish to export
- F7 to save as AVI, make the output name "s02e20-cropped.avi"
- Save your processing settings, including your selection and edit list (checkbox at the bottom of the save dialog), e.g. "s02e20-capture2cropped.vcf"

And there goes another large chunk of disk space (10Gb/hr)! Processing speed on my AthlonXP 2600+ is around 20-30fps. Process all of your clips from a single episode during the same session, making sure to re-select the proper WAV file for each clip, so that your video filters are identical for all of the clips.

Optionally, you can choose to crop as a seperate step, but it's just as easy to do it now.

D. Final Audio Edit (optional): This is somewhat of an optional step, depending on how good you were at cutting and whether the audio in each cropped clip sounds okay at the start/end of the clip. Sometimes I find that the audio track starts too abruptly or gets cut off abruptly. When this happens, I export the audio to WAV again (de-muxing), load it up in Cool Edit 2000, adjust the fade-in / fade-out of the clip, and then save the new audio track in a seperate WAV file ("s02e20-cropped-faded"). I don't need to re-mux the audio back into the AVI, because TMPGEnc will allow me to do the re-muxing during the conversion to MPEG2.

E. Convert to MPEG2: This will take a while, so plan on setting this up to run overnight, or when you're going to do something else on the computer that doesn't take a lot of CPU power (checking e-mail, web browsing). TMPGEnc can be set to run at "idle" mode, which means that it will play nicely in the background, only using CPU cycles that you didn't use to run whatever other application you're using now. Note that playing a high-CPU requirement game like a FPS or other 3D-type game will eat up a lot of CPU and pretty much starve the TMPGEnc process.

Word of warning: I've just started using TMPGEnc today so I may not be doing things properly or best, but at least it's a starting point. I'll fine-tune the process later.

Encoding time for a 720x480 clip (8 megabits/sec output, with variable bit rate or VBR):
- AthlonXP 2600+ - 4 hrs per 1 hour of video
- Athlon 1Ghz - 12 hours per 1 hour of video
- Pentium 1.4Ghz laptop - 6 hours per 1 hour of video

Bit-rate vs disc capacity (using 256kbps AC3 audio and a 4.7Gb recordable DVD):
- 8000kbps Video, 70 minutes
- 6000kbps Video, 95 minutes
- 5000kbps Video, 115 minutes
- 4500kbps Video, 125 minutes

The MPEG2 encoding is really slowing me down, which means I'm probably going to leave off here and try finishing up my guide later. I have produced a DVD that plays in a regular DVD player, mostly by using the wizard in TMPGEnc to encode at 8000kbps. Burning to DVD-RW did not work however, but DVD+RW media worked in the particular DVD player that I'm using to test. (My older DVD player will not read any recordable media.)

Labels:



posted by Wuphon's at 9:55 AM

Powered by Blogger Who's linked to me?