--- sean <[EMAIL PROTECTED]> wrote: >I'm also trying to convert a series of old vhs >family tapes. I'm using a borrowed canopus advc >300. I'm about 103 artifacts to go before >perfection. Could you post how you are >converting your tapes? The more specific the >better - i.e. actual command lines.
Enclosed is the bash script that I used recently to clean up a very difficult video tape. (It's a video-collage piece, made from stuff recorded off TV, so I've got a couple layers of videotape noise to punch through.) Before I get into that, though, let me cover some basics. Make sure you are using good audio/video cables! I swear by Monster cables. My 1-meter composite-video cable, the most expensive one I could find at Best Buy that day, cost US$60. Note that I'm using a composite-video cable, even though my VCR can put out an S-VHS signal. The issue here is who does the color separation. If I play a VHS tape and use an S-VHS cable to carry it from the VCR, then the VCR is doing color separation. My Canopus ADVC-300 box has software-assisted color separation; I'd rather use that than take a chance on what my VCR is doing. Sound encoding is pretty straightforward. 00.wav was generated from 00.dv with "smil2wav 00.dv > 00.wav". wavamp16 is a stupid program I wrote that lets me amplify audio to the point where it clips. My theory is, normal analog videotape audio has its own pops and clicks, and normalizing with them in mind produces audio that's way too quiet. So I (arbitrarily) decided that one clipped sample per minute would not generate audible artifacts. Another stupid program I wrote, wavcalcamp16, tells me how much I can amplify an audio sample so that I get a certain number of clipped samples. It generated the 1.675 value you see in the script. ffmpeg is the only open-source program I know of that can generate Dolby AC3 audio, so I use it. Now on to the video encoding. "raw2yuv -i 2" generates raw YUV data from DV data, but with a 4:1:1 color scheme instead of 4:2:0. In English, that means the color plane is 720x480 instead of 360x240, like it needs to be for DVD video. The issue is, raw2yuv's method of downsampling color data is low-quality. The y4mscaler command immediately after raw2yuv, which I got from Steven Schultz, does a high-quality color downscaling. I noticed the difference the first time I tried it -- colors were MUCH more vibrant. The "yuvscaler" command just clips off the bottom few lines of video, which on a videotape always seems to consist of blurry noise. No sense encoding that -- you'll never see it, and because of its lack of predictability, it's expensive for MPEG to encode it. Note that I don't clip the left or right edges; I find y4mdenoise does a good job of resolving the black bars on the sides, so I don't need to do anything special to them. The "yuvcorrect" command is a recent addition, and although it didn't have the desired effect, I still think it's worthy. All it does is clip the pixel values to the range needed to display properly on a TV screen. I run it before y4mdenoise so that any artifacts generated by yuvcorrect's clipping can get smoothed away. The "y4mdenoise" command (here called "newdenoise", since I'm usually developing it & rebuild it often) is the most important part. On a really clean videotape, like something shot from a VHS-C camera, you can use "-z 1 -t 2" in place of "-z 2 -t 3". "-m 15" is experimental, but seems to produce vastly better results than the default, which is 10. "-M 3" is the default, but since I'm experimenting, I like to have everything specified explicitly so I'll remember to write it down in my recording notes. (The right side of every VCD and DVD I produce contain copious notes on the recording and processing, so I can learn from my previous work.) The "yuvmedianfilter" command is there to lightly blur the video, to remove spatial noise that becomes really obvious once y4mdenoise has done its job. After all this, the video is sent to bzip2 and mpeg2enc. It turns out that y4mdenoised video compresses really well with bzip2. My experiments suggest the compression ratio approaches DV compression, i.e. 4-to-1 or better. Since I don't know what -b/-q values mpeg2enc needs to do my video properly, I like to have a copy of the denoised video around. "yuv2lav" is NOT sufficient for storing denoised video; the JPEG compression introduces artifacts (especially on slanted transitions between very light areas and very dark areas), and seems to increase the necessary MPEG bitrate by around 5%. Finally, the video goes to mpeg2enc. I've discovered that the -q parameter is very handy for removing the last bits of noise that y4mdenoise can't remove. As I lower the -q value, I eventually find noise creeping back into the video. I try to find a balance between detail and noise, and for most of my y4mdenoised videotapes, -q 3 is a good place to start. I'm hopeful that the recent rash of mpeg2enc debugging will improve this; as soon as I hear from Andrew Stevens that he's looked at the 2 video clips I sent him & has resolved those issues, I'll be back to testing the CVS version of mpeg2enc. (Bugs are keeping me from using "-q 2" or "-q 1" reliably.) In the commented-out portions of my script, you can see how I generate VideoCDs. After using yuvmedianfilter to blur the video slightly (but in a non-interlaced way, so as to lightly deinterlace the video), I downscale it to VCD size, and before sending it to mpeg2enc, I pipe it through y4mdenoise with the error limit turned all the way down. Here, y4mdenoise is not being used to remove noise, it's being used to condition the video stream numerically so that motion-detection has a better chance of succeeding. It produces a noticeable increase in detail on the final VideoCD. Hope this helps. Feel free to ask questions. I think this is everything I know about producing artifact-free digital video, but who knows. Steven Boswell ulatekh at yahoo dot com __________________________________ Do you Yahoo!? Meet the all-new My Yahoo! - Try it today! http://my.yahoo.com
makedvd.sh
Description: makedvd.sh