Workflow to save time, better quality + ghosting in video? - Page 2 - digitalFAQ Forum
 Forum Workflow to save time, better quality + ghosting in video?
 Ask Question Join / Register FAQ Search Today's Posts Mark Forums Read

#21
05-24-2015, 04:50 AM
 sanlyn Premium Member Join Date: Aug 2009 Location: N. Carolina and NY, USA Posts: 3,648 Thanked 1,264 Times in 971 Posts
Capture samples for analysis are almost always requested as unprocessed. If you captured to YUY2 AVI using Lagarith lossless compression, then losslesss Lagarith YUY2 AVI is what you want for a sample. You can open the original AVI capture file in VirtualDub, make the cut you want, then save it using "Direct Stream copy". 10 seconds of 720x480 Lagarith AVI shouldn't be more than 30-40MB or so (depends on how much action/detail/etc). Include a scene with motion, not necessarily camera motion but something moving, walking, or whatever, so that interlace patterns or problems can be watched. Don't filter, deinterlace, fix color, or anything else.

Usually the discussion centers on anything that might be amiss or easier to configure in the capture setup, or any fix-up processing. Some people do a quickie cleanup on VHS, others get into more detail -- it depends on the source and what you want to do with it. But you'll likely get plenty of detail and procedure to work with.

Someday, 12:01 PM
 Ads / Sponsors Join Date: ∞ Posts: 42 Thanks: ∞ Thanked 42 Times in 42 Posts
#22
05-24-2015, 09:07 AM
 mo418 Free Member Join Date: May 2015 Posts: 43 Thanked 0 Times in 0 Posts
Hi! Here are 2 unprocessed samples, not even audio synced

Attached Files
#23
05-24-2015, 12:06 PM
 msgohan Free Member Join Date: Feb 2011 Location: Vancouver, Canada Posts: 1,323 Thanked 328 Times in 273 Posts
The frame rate is wrong (should be 30000/1001 = 29.9700299700... repeating not 1000/33 = 30.30...). Lines are wiggling (line TBC is needed). Something is very wrong with the chroma, part of which does look like CUE but that's not the only thing. A sort of grid covers the luma (leakage/crosstalk from chroma?).

On the plus side, you can definitely do better. But I think you may want to avoid this capture device.
#24
05-24-2015, 01:03 PM
 mo418 Free Member Join Date: May 2015 Posts: 43 Thanked 0 Times in 0 Posts
I saw that there's an option in virtualdub that round to nearest millisecond in capture/settings/frame rate. I remember I clicked on this. It went from 29 something to 30 something. That's the culprit.

Line Time Base Correction. Another thing I need to learn hehe (no worry, I will do my research)

I guess I will need to find a new capturing device as you suggest... But I don't want to spend too much on this, so I guess my budget will not allow me to do way better
#25
05-24-2015, 05:11 PM
 sanlyn Premium Member Join Date: Aug 2009 Location: N. Carolina and NY, USA Posts: 3,648 Thanked 1,264 Times in 971 Posts
Thanks for the samples. And to msgohan for input.

You don't have to zip compressed video. in fact, you saved less than 200 bytes of space on both samples. No big deal, though. Well....what's first?

If your video is supposed to be 29.97 fps, that's the value to have in VirtualDub capture.

Video8 and other NTSC analog tape sources usually originate and play as Top Field First (TFF). First thing I notice is that the captures should play as TFF, but they're Bottom Field First(BFF). Usually, the only common format that uses BFF is DV. At some point field structure and phase were altered. This causes problems including interlace glitches. If at any time these videos went through DV or DV playback, they should be transferred to a PC via Firewire, not recorded as analog.

Most consumer analog audio usually has a sampling rate of 44Kh for DV and (I think) 48KHz on VHS, correct me if I'm wrong. Usually analog tape is capped to 48KHz audio (44KHz for DV), since DVD and BluRay use it that way. The sample rate for Sample_01 is 22.05 KHz, for Sample_02 it's 44.1 Khz. The audio bitrate for uncompressed PCM is usually 1536 kbps Constant. For both samples it's half that (705.6 kbps, which I didn't even think was done in VirtualDub). The first thing I did with both these videos was open them in Avisynth, re-set the audio sampling rate to 48KHz, and save audio-only as new .WAV (PCM) files. Then I remuxed video+audio in the Avisynth script.

Next thing I did was run an Avisynth script that cropped off the black borders so I could get a YUV histogram. Both histograms in the images below show bright-end clipping and elevated black levels around RGB 30. This isn't too bad in the hockey clip, but it makes the Jeep clip look a bit washed out and really upsets trying to correct gamma and some other things.

What you say you see as "interlace" lines is aliasing and broken angular lines on motion. When played, the aliasing and broken lines will "Twitter". That's why it's called "line twitter". Twitter on angular lines is a common problem with consumer cameras, but field order problems can make it look worse.

Below, Sample_01, frame 82 (interlaced), black borders removed, and a YUV histogram:

Look at the stripes and edges of the players' uniforms and you'll see aliasing, not interlace double images. Those objects and the numbers on the time clock show dot crawl as well. In the white "luma" portion of the YUV histogram, look at the right-hand side. Where white turns orange and smashes against the right-hand edge, that data will be clipped in RGB display. The tall "spike" at the left indicates crushed darks with no detail.

Below, Sample_02, frame 18 (interlaced), black borders removed, and YUV histogram:

Again, the histogram shows slightly elevated blacks and clipped brights. To see the effects of clipping, look at the back of the guy's neck. Blue in the shirt and colors in skin tones are clipped and changed to near white. Some of this was recovered by fixing levels in YUV with Avisynth. The field/interlace problem is seen in the blue ghosting (even the ghost shows aliasing) and in some of the edges of the jeep's hood, front upper window panel, front fender, and elsewhere. In case you haven't noticed, there's been a color shift: the jeep, mud, and tires are purple.

If you think deinterlacing fixes the alias effect, it doesn't. Below are 2X blowups of QTGMC deinterlaced frame 18, where the fields in progressive mode become frames 36 and 37. Aliasing exists in both fields.

Attached are two version of Sample02, one interlaced, one progressive, with some fixup and color correction. In the 29.97 interlaced version, you can see aliasing isn't fixed by deinterlacing and filtering the video, then re-interlacing. In the 59.94p progressive version, aliasing is relieved somewhat as progressive video because aliased fields aren't blended, but many edges are still "disturbed" when anything moves. Two anti-alias filters were used on both clips, which should not have been necessary.

The audio sync sounds about right to me, unless it's several seconds off (the jeep seems to groan and creak right on time). But the full clip might still have problems with nonstandard caps of the audio sampling rates and bitrates. This is a sample of the code I used to remux audio+video after making a resampled audio file from Sample_02:
Code:
aud=WAVSource("drive:\path\to\video\SAMPLE_02.wav")
vid=AviSource("drive:\path\to\video\SAMPLE_02.avi")
AudioDub(aud,vid)
AssumeFPS("ntsc_video",sync_audio=true)
Later I'll post details of how I made the re-encoded clips. The double-frame rate progressive is mp4 -- my encoders won't allow to-spec DVD or BluRay 720x480 at 50fps progressive. Not satisfied with either of them.

I'll echo msgohan, you need better capture gear. A good device doesn't cost a fortune, but Windows8 does impose limits. What camera are you using to play the tape? If its a DV camcorder, it's outputting DV from analog tape. Can you give us some history about how these tapes originated and were played?

Attached Images
Attached Files

Last edited by sanlyn; 05-24-2015 at 05:35 PM.
#26
05-24-2015, 06:13 PM
 mo418 Free Member Join Date: May 2015 Posts: 43 Thanked 0 Times in 0 Posts
Quote:
 You don't have to zip compressed video. in fact, you saved less than 200 bytes of space on both samples. No big deal, though. Well....what's first?
Yeah I know. I'm an engineer and work with CAD software. It's a reflex to do so because I do data delivery to clients everyday.

Quote:
 Video8 and other NTSC analog tape sources usually originate and play as Top Field First (TFF). First thing I notice is that the captures should play as TFF, but they're Bottom Field First(BFF). Usually, the only common format that uses BFF is DV. At some point field structure and phase were altered. This causes problems including interlace glitches. If at any time these videos went through DV or DV playback, they should be transferred to a PC via Firewire, not recorded as analog.
From websearch, I found infos to create script in avisynth to find if I had interlaced or progressive footage , and if it was TFF or BFF. by looking at the frame order when going frame by frame. I had this. This is how I discovered I had interlaced footage and that I needed TFF.

AVISource("filename.avi")
AssumeTFF()
# or AssumeBFF()
SeparateFields()

Quote:
 Most consumer analog audio usually has a sampling rate of 44Kh for DV and (I think) 48KHz on VHS, correct me if I'm wrong. Usually analog tape is capped to 48KHz audio (44KHz for DV), since DVD and BluRay use it that way. The sample rate for Sample_01 is 22.05 KHz, for Sample_02 it's 44.1 Khz. The audio bitrate for uncompressed PCM is usually 1536 kbps Constant. For both samples it's half that (705.6 kbps, which I didn't even think was done in VirtualDub).
It was done in virtualdub. Audio compression was none (PCM), but I played with the raw capture format since I thought that lowering bitrate might help for my sync issue (I think I found this advice over the web). Did many try, so that's why you have different values. Sorry, I sampled footage I took a few days ago. Did so many trials before asking here that I didn't remember this! Sorry for this

Quote:
 Next thing I did was run an Avisynth script that cropped off the black borders so I could get a YUV histogram. Both histograms in the images below show bright-end clipping and elevated black levels around RGB 30. This isn't too bad in the hockey clip, but it makes the Jeep clip look a bit washed out and really upsets trying to correct gamma and some other things.
This, I understand better since it's the same as in photography. Right spikes means bright spots, left is dark.

Quote:
 Look at the stripes and edges of the players' uniforms and you'll see aliasing, not interlace double images.
I knew there was something more than this because the effect was not only horizontal. Then aliasing is exactly the same as when I play pc games. Video cards have anti-aliasing which help reduce the "non-uniform" lines when at an angles (I think so, but do not know the theory like you guys do!)

Quote:
 In case you haven't noticed, there's been a color shift: the jeep, mud, and tires are purple
You have better eyes than me. I haven't!

Quote:
 I'll echo msgohan, you need better capture gear. A good device doesn't cost a fortune, but Windows8 does impose limits. What camera are you using to play the tape? If its a DV camcorder, it's outputting DV from analog tape. Can you give us some history about how these tapes originated and were played?
I'm on windows 7, for info. It's not a DV camcorder. It's an old analog 8mm camcorder (early 2000's). They were filmed, and I simply plug the cam to the capture device and transfer them to the PC.

Here is the model of my *cough* magnificient *cough* camera

hitachi VM-E545LA

http://diagramas.diagramasde.com/cam...0LA_E545LA.pdf

Guys, thanks for putting so much time in someone else's problem! That is more than appreciated!

Last edited by mo418; 05-24-2015 at 06:38 PM.
#27
05-24-2015, 06:46 PM
 sanlyn Premium Member Join Date: Aug 2009 Location: N. Carolina and NY, USA Posts: 3,648 Thanked 1,264 Times in 971 Posts
Quote:
 Originally Posted by mo418 Yeah I know. I'm an engineer and work with CAD software. It's a reflex to do so because I do data delivery to clients everyday.
Yep, I had the same ITT xperience. Like I say, no big thing. Thought I'd saver you some time.

Quote:
 Originally Posted by mo418 From websearch, I found infos to create script in avisynth to find if I had interlaced or progressive footage , and if it was TFF or BFF. by looking at the frame order when going frame by frame. I had this. This is how I discovered I had interlaced footage and that I needed TFF.
That's a good way to check things out. The videos are interlaced, for sure. But both are BFF.
#28
05-24-2015, 07:46 PM
 mo418 Free Member Join Date: May 2015 Posts: 43 Thanked 0 Times in 0 Posts
So, I don't have your experience in video manipulation.

What should be my next step?

Let's say I keep the same capture device...

Should I try to capture with (at least) better cables, with low sharpening level (or none) in virtualdub?

I will keep it interlaced for now, no deinterlacing process

Btw, I'm not too picky. Your samples look quite good compared to what I have achieved

I could upload samples of what I get to see if things get slightly better
#29
05-24-2015, 10:01 PM
 sanlyn Premium Member Join Date: Aug 2009 Location: N. Carolina and NY, USA Posts: 3,648 Thanked 1,264 Times in 971 Posts
Quote:
 Originally Posted by mo418 So, I don't have your experience in video manipulation.
Wow, that's a great compliment, and thanks. Brother, I wish I knew more, but I'm really just following others. Anyway, you pick up stuff as you go along, and you're looking in the right places.

It's not as complicated as it looks at first. Tomorrow I'll have more time to break down what I did, step by step. That's how it was taught to me. I don't recall finding any single source or project that had it all in one place.

Quote:
 Originally Posted by mo418 What should be my next step? Let's say I keep the same capture device...
You need a better capture device, or the effort gets no easier -- gets tougher, really, because constant annoyance and frustration will make you (or anyone) pretty tired of this game before very long. If your friend's EZCap is the real thing, give that a try. It can't be worse than the Honestech. I see you have Win7. That puts you a step ahead of Win8 owners who have less choice. We know from many users and other forums that the ATI USB 600/650 and Diamond Multimedia ATI TV Wonders 600/650 give about the best results around these days, aside from forking up $1100 for cards whose features you'll never use and can't afford anyway. Excessive interlace combing and audio sync glitches aren't the only thing the Honestechs are notorious for. At least your camera is one many are looking for and are making do with worse. I might be imagining things, but it seems to me that Hauppauge had a pretty good budget capture device in a "110" or "100" series, can't recall if it was PCI or USB. Maybe one of the readers will recall that one, as I sew it pop up at auctions now and then. You wouldn't want their newer TV Wonder 750 USB's, they're a step down. Quote:  Originally Posted by mo418 Should I try to capture with (at least) better cables, with low sharpening level (or none) in virtualdub? Cables won't make much difference, given the device you use now. If you're not using s-video from the camera, you should be (I forget whether it has s-video or not). That would reduce color noise at least. Sharpening during capture does more harm than good -- after all, who needs sharpened noise? Most s-video cables are pretty much alike, unless you've got the cheapest 99-cent wonder ever made. Mine are from BlueJeansCable. They're not cheap, but there are$100-per-foot to $500 s-video cables out there that look worse. If composite RCA is the only choice, try Amazon or eBay for some old Acoustic Research blue-jacketed Performance Series composite cables. Many say this budget brand is better than the more expensive Pro-II series, which looks too soft. http://www.amazon.com/Acoustic-Resea.../dp/B00005LACF . Unfortunately their blue s-video cable ain't as sharp. The "blue RCA's", as you see from Amazon, are getting scarce. Quote:  Originally Posted by mo418 I will keep it interlaced for now, no deinterlacing process Much of the difficulty in treating things like ghosting and other capture-time artifacts requires deinterlacing. You can encode interlaced high bitrate archives. But since you're using PC playback anyway, and if you want to encode to mp4 or mkv for TV playback via USB drive or external player, you can go with 59.94 progressive video. Quote:  Originally Posted by mo418 Btw, I'm not too picky. Your samples look quite good compared to what I have achieved Thanks again. But don't underestimate your own progress. You'd be amazed at some of the godawful stuff we've seen, and from users with pretty nice gear! Quote:  Originally Posted by mo418 I could upload samples of what I get to see if things get slightly better Be more careful with your VirtualDub settings. I usually make a quickie of a minute or so and check it in VirtualDub before I commit to longer captures. Also a good idea to not capture entire hours movies at one time, unless they're pretty short clips to begin with. I'll post more details on what I did with the samples, later. You know how these holiday schedules go... #30 05-24-2015, 11:06 PM  mo418 Free Member Join Date: May 2015 Posts: 43 Thanked 0 Times in 0 Posts Hi! Quote:  I'll post more details on what I did with the samples, later. You know how these holiday schedules go... Yes it's memorial day there tomorrow (guessing you're from USA). Forgot about this! (I'm in canada) Don't take too much time of your long weekend to reply to me! BTW, just found this in craigslist for 30$ (CAN)

ATI TV Wonder HD 650 COMBO USB ATSC FM Radio
http://www.kijiji.ca/v-autre-ordinat...ationFlag=true

Is this what you're talking about?

Is it the same as Hauppauge, i.e. is this automatically encoded right after capturing?

Found this also, for 8$haha ATI Theater 550 Pro TV Tuner PCI NTSC & Analogue, S-Video IN http://www.kijiji.ca/v-autre-ordinat...ationFlag=true Quote:  Cables won't make much difference, given the device you use now. If you're not using s-video from the camera, you should be (I forget whether it has s-video or not). That would reduce color noise at least. It does not have S-Video out. So considering buying a new capture device (better), reading earlier post, I should buy a Composite to S-Video adapter to separate luma from chroma right?. Please, correct me if I'm wrong! Quote:  At least your camera is one many are looking for and are making do with worse. Not sure to clearly understand the statement. Am I reading wrong, or you're saying that my camera is not bad at all? haha (Sorry I don't get all expressions despite I know English hehe) If so, I didn't think this at all. Quote:  Much of the difficulty in treating things like ghosting and other capture-time artifacts requires deinterlacing. You can encode interlaced high bitrate archives. But since you're using PC playback anyway, and if you want to encode to mp4 or mkv for TV playback via USB drive or external player, you can go with 59.94 progressive video. If I'm able to achieve better results, then yes I will go with deinterlacing to expand playback possibilities. This being said, I'm going to bed because I work tomorrow (sad but true). No holiday for me. BTW, no rush mate. Have good time! #31 05-25-2015, 12:59 AM  msgohan Free Member Join Date: Feb 2011 Location: Vancouver, Canada Posts: 1,323 Thanked 328 Times in 273 Posts The ATI 650 has a known flaw with the AGC (also here). The 750 is said to have the same problem, but possibly more source-dependent (PCIe / USB). The 550 is pretty good, from what I've seen (I actually bought one myself but have only used it for a few minutes).$8 for it is a no-brainer if it includes the purple breakout box. It can capture lossless, but the newest drivers are only for Windows Vista x64, not Windows 7. I forget whether I managed to use it in Win7, but a post on NeoWin claims the Vista drivers can be installed in compatibility mode. One nice thing that might help you is that it offers a 3D comb filter to reduce dot crawl, if that is the problem we're seeing with the chroma. The often-recommended ATI 600 only has a 2D comb filter, like most other capture devices.

Having said that... there's an annoying issue with a lot of these devices where the Proc Amp controls only work on XP. And you need those controls.

Quote:
 Originally Posted by mo418 So considering buying a new capture device (better), reading earlier post, I should buy a Composite to S-Video adapter to separate luma from chroma right?.
Once they're mixed, there is no way to perfectly separate them. The plug adapters like you bought are essentially just scams; properly converting from composite to S-Video requires active electronics to perform comb filtering. Some DVD recorders like the Panasonic DMR-ES10 / 15 / 25 do 3D comb filtering as well as line TBC, so people like us who prefer to capture lossless often pass signals through those and capture the output.

Last edited by msgohan; 05-25-2015 at 01:21 AM.
#32
05-25-2015, 04:35 PM
 mo418 Free Member Join Date: May 2015 Posts: 43 Thanked 0 Times in 0 Posts
Didn't know about AGC. Seems to be a PITA...

I don't know, I see shared comments on the ATI cards (saw a post where lordsmurf told they were s**t). Though, it is probably better then what I have, so for the price...

A friend (same who lent the easycap) told he had a Matrox Mystique laying around. Don't know about this, but who knows, maybe you guys know this and this is good hardware.

This being said, I have a complete computer laying around at home ready to install windows XP (old hardware). I could use it and add the 550 to it.

Just for fun, here is an example of an easycap capture through virtualdub.

Attached Files
#33
05-25-2015, 06:59 PM
 lordsmurf Site Staff | Video Join Date: Dec 2002 Posts: 11,688 Thanked 2,138 Times in 1,839 Posts
Where did I say the ATI cards were not good?

- For sale in the marketplace: TBCs, workflows, capture cards, VCRs
#34
05-25-2015, 07:08 PM
 mo418 Free Member Join Date: May 2015 Posts: 43 Thanked 0 Times in 0 Posts
Sorry, please don't get me wrong! It was not negative.

Let me find again where I found the post in question.

EDITED:
There, but still sorry. I was at work and read quickly. Though, you did not seem to appreciate them.

Last edited by mo418; 05-25-2015 at 07:22 PM.
#35
05-25-2015, 09:36 PM
 msgohan Free Member Join Date: Feb 2011 Location: Vancouver, Canada Posts: 1,323 Thanked 328 Times in 273 Posts
The Easycap sample doesn't have the CUE problem. Line wiggling looks like it may actually be worse though. If your variant is like my \$6 Easycap STK1160 toy, the composite input is quite blurred. That does appear to be the case, though it would be easier to tell if you captured a DVD rather than a tape.

Quote:
 Originally Posted by sanlyn First thing I notice is that the captures should play as TFF, but they're Bottom Field First(BFF).
I haven't double-checked SAMPLE_02, but the original SAMPLE_01 is TFF.
#36
05-26-2015, 05:49 AM
 mo418 Free Member Join Date: May 2015 Posts: 43 Thanked 0 Times in 0 Posts
Hi

I asked my friend and he confirmed it's not a genuine easycap.

I found the colors were better, but the overall quality worst.I guess my observations are like yours, but without good explanations as you did.

So definitely I think it is safe to assume the honestech device is the culprit for many issues.

The guy for the ati 550 is out of town until Thursday. I'll keep you posted.

He has the 550 and 650 in hand. Which one would you go with? I have a feeling I'd be better with the 550, don't know why though!

#37
05-26-2015, 11:32 AM
 dpalomaki Free Member Join Date: Feb 2014 Location: VA Posts: 1,406 Thanked 320 Times in 278 Posts
d=
Quote:
 ...sampling rate of 44Kh for DV and (I think) 48KHz on VHS,
I believe that DV was typically 48 kHz/16-bit stereo, or 32 kHz/12-bit with up to 4-channels. Some camcorders defaulted to the 32kHz rate, some to 48kHz. The 32 kHz rate allowed audio insert on tracks 3 and 4 in post.

Analog VHS did not have a specific sampling rate on tape disregarding some possible DSP in the record/playback electronics. (It was recorded as linear tape track, and as a FM-coded signal on stereo Hi-Fi VCRs.)

Although the DV spec allowed 44.1 kHz audio, it was not widely used with video.
#38
05-26-2015, 02:32 PM
 sanlyn Premium Member Join Date: Aug 2009 Location: N. Carolina and NY, USA Posts: 3,648 Thanked 1,264 Times in 971 Posts
@dpalomaki, thanx for the audio info.

@mo418: Here are some details on what I did with Avisynth and VirtualDub on Sample2.avi. Firsv step was to open the AVI in VirtualDub, resample the audio to 48KHz, and save audio-only as a .WAV file (uncompressed PCM). Then I remuxed video and audio in the script, as you'll see below. This sometimes brings audio into sync, but you might still have the do it the hard way as you did earlier.

Below,good old frame 84 (deinterlaced frame 42)\, with borders removed using the Crop() function. Crop() has important restrictions, depending on colorspace and whether interlaced or progressive. Have a look at the chart at the bottom of this Avisynth help page: http://avisynth.nl/index.php/Crop. The black levels aren't bad, even if not much detail under the jeep. Pretty dark down there, so I didn't try to force detail out of areas that don't matter anyway. GAmma is high, giving a washed-out-look. Brights are clipped, as the detail on the back of the guy's neck shows. There's also a downward chroma shift of blue by about 6 pixels (look at the guy's shirt sleeve).

The same frame, deinterlaced, after the Avisynth script and borders restored. Notice that the "spike" at the right end indicates clipped brights during capture or during shooting. But some of the brights were retrieved here. The big orange spike at the left is the black borders and a small part of the murky detail under the jeep.

Only a tiny speck of bright luma gets close to the unsafe area at the right. This video was shot under overcast light, so it won't have the same high-end range as a sunlight shot. The result is a little green, but I took care of that in VirtualDub while watching this script run.

Here is the Avisynth script. Everyone has their own way fo doing things, but this is what I did with a quick run through:
Code:
aud=WAVSource("Drive:\path\to\audio\SAMPLE_02.wav")
vid=AviSource("Drive:\path\to\video\SAMPLE_02.avi")
AudioDub(aud,vid)
AssumeFPS("ntsc_video",sync_audio=true)

ColorYuv(cont_y=-20,off_y=-15,cont_u=-50,gain_u=-20)
ConvertToYV12(interlaced=true)
SmoothLevels(16,1.05,255,16,245,chroma=200,limiter=0,tvrange=true,dither=100,protect=6)

AssumeBFF().QTGMC(preset="medium",NoiseProcess=1, GrainRestore=0.2, NoiseRestore=0.2, NoiseTR=2)
ChromaShift(C=2,L=-6)
DeHalo_Alpha(rx=3)
### AssumeBFF().SeparateFields().SelectEvery(4,0,3).Weave()
Santiag(2,2)
ConvertToRGB32(matrix="Rec601",interlaced=false)
return last
aud=WAVSource("Drive:\path\to\audio\SAMPLE_02.wav" )
vid=AviSource(
"Drive:\path\to\video\SAMPLE_02.avi")
AudioDub(aud,vid)
AssumeFPS("ntsc_video",sync_audio=true)

All of these functions are Avisynth built-ins. "aud" is a name I "invented" for the audio input, "vid" is the name I "invented" for the video. These are user-created variables that nyou name whatever you want, as long as they aren't the same name as a function or filter.

Cropping is in interlaced YUY2 (must be mod-2). AddBorders() restores the original frame size and centers the image. The default border color is RGB-0 black.

ColorYuv(cont_y=-20,off_y=-15,cont_u=-50,gain_u=-20)
ConvertToYV12(interlaced=true)
SmoothLevels(16,1.05,255,16,245,chroma=200,limiter =0,tvrange=true,dither=100,protect=6)

ColorYUV is mainly used to reduce luma contrast (cont_y) and shift the image luma/colors to the dark end with a negative offset (off_y=-15). Blue is oversaturated and exceeds RGB 255, so I reduced blue contrast (which sort of "shrinks" the u channel toward the middle) and reduced blue bright-end gain (gain_u). Next comes SmoothLevels, which requires YV12. Notice that the conversion to YV12 stupulates that the video is interlaced at this point. SmoothLevels uses several techniques to reduce banding and color gaps. Here, it mainly reduces bright clipping by interpolating RGB 255 down to RGB 245. The second digit in the SmoothLevels values is gamma (midtones), which I raised slightly. "Protect=6" leaves blacks below RGB 6 untouched. SmoothLevels is a function is the SmoothAdjust plugin.

AssumeBFF().QTGMC(preset="medium",NoiseProcess=1, GrainRestore=0.2, NoiseRestore=0.2, NoiseTR=2). QTGMC defaults to the Avisynth default (BFF), but I like to be more specific about these things. The "medium" preset doesn't denoise as strongly as "slow", which often scrubs away too much detail. The other values inhibit denoising a bit, and restore some of the original grain and noise. Let's face it, analog "detail" is really lots of noise anyway, and I didn't want to discard too much.

ChromaShift(C=2,L=-6)
DeHalo_Alpha(rx=3)

Chroma is shifted 2 pixels to the right and 6 pixels up. SOmetimes this looks cool, sometimes shift is so screwy it could look weird. One thi9ng it fixed was the blue bleed below the guy's shirt sleeve and some of the color washout on the back of his neck. DeHalo_Alpha helps reduce playback oversharpening halos. Not a real fix for ghosts, though. I used a horizontal pixel width (rx) of 3; the default is about 1; high values can sometimes make worse edge artifacts, but it seems to be OK here. These are two filters that require a little fiddling.

### AssumeBFF().SeparateFields().SelectEvery(4,0,3).We ave()
This is a re-interlace routine. Note that it is commented-out here.

Santiag(2,2). This is an anti-alias plugin. Probably most effective with interlaced video, but it works on progressive as well. The (2,2) values are the stronger setup. It does soften video a little.

ConvertToRGB32(matrix="Rec601",interlaced=false). To RGB for VirtualDub work. Note that the video is not interlaced at this point. If the video had been reinterlaced, the statement would need "Interlaced=true". If you don't want to use RGB filters, you won't need this statement.

return last. You need this statement at the end because other entities have been named earlier in the script ("aud" and "vid"). "Return last" returns the result of the last executed excuted statement. Otherwise Avisynth would be a bit confused as to exactly what you want to come from this script, and you'd get ye olde Avisynth error message.

Below, the frame after VirtualDub color and gamma tweaks. The number VDub filters I used isn't usually necessary. Not a vast difference, but anti-ghost was used and the color looks more natural.

The attached Avisynth_plugins.zip has the AVisynth filters I used, in case you don't have them. You already have the QTGMC package, which is a good thing because some of those plugins use QTGMC support files. The filters included are ChromaShift, DeHalo_Alpha, Santiag, SangNom (used by Santiag), and the SmoothAdjust package version 2.60, which works in all versions of Avisynth (and which has dll's for Intel and AMD systems, so look over the docs that come with it. Use 32-bit versions). It also includes a deinterlacer named MAA. It softens a bit, too, but you should use it only on interlaced video before any deinterlacing. I didn't used it here.

Attached Images
Attached Files
#39
05-26-2015, 03:27 PM
 sanlyn Premium Member Join Date: Aug 2009 Location: N. Carolina and NY, USA Posts: 3,648 Thanked 1,264 Times in 971 Posts
Color balance is usually a personal matter, so if you don't like what I did in VirtualDub you can always change it to suit. It does help to know how some of these filters work. Best way to learn? Mount the filters, start pushing sliders and clicking buttons, and watch what happens.

Attached is VirtualDub_filters.zip, with these plugins: ccd_sse2 (CamcorderColorDenoise), ColorMill, Exorcist, GradationCurves, and Hue/Saturation/Intensity. If you already have some of these in lordsmurf's VDub filter package, you're a step ahead. I also attached csamp.zip, which includes a desktop pixel sampler that you can use with VirtualDub and other apps in the Windows desktop. This is not a filter plugin. There's no installer. Just copy csamp.exe to your desktop. When you run Csamp,you can place its little window anywhere om the desktop. It comes with instructions. While it's on, you'll also see small icon in the taskbar's right-hand corener. There's a sample of its use in the images below.

I used the exorcist.vdf plugin to diminish that blue ghost. There are better ways of doing it in Avisynth, but you'd need a slew of old samples and other plugins to use it, and those methods sometimes do more harm than good. I just didn't have time to get too fancy with masking routines. If you create a dark anti-ghost with exorcist it will darken and lower gamma, so you need to compensate for that with other filters. I used ColorMill, gradation curves, and the built-in "Levels" filter to restore some dynamic range. I used the Hue/Sat?Intensity filter to lower Cyan saturation in that shirt (cyan=green + blue). I used ColorMill to tweak color balance toward red a bit, to increase saturation in the yellow range, and to tweak Blue in the darks and brights.

I'm also including a .vcf settings file. I don't know if vcf's were mentioned earlier. A .vcf is a file used to store VirtualDub filters and settings as used when processing a video. For a .vcf to work, the filters mentioned must be in your Avisynth plugins folder. To load the filters in VirtualDub, use "File..." -> "Load processing settings", navigate to the location of the vfc, select it, and click Open or whatever. The filters will load with the same order and settings I used. Be sure to re-check your output colorspace and compressor. You must use "Full processing mode". When the filters are loaded you can open each in the filter chain and look at the settings I used. If you really wanna get geeky, a .vcf is a plain text file that you can open in Notepad.

There was nothing extreme about the settings I used in Sample2. It's probably more illustrative to use more extreme images from a previous project of a few years ago. Look at the image below, from a bad VHS of a documentary on Cher. It's too dark, too yellow, too red. Skin tones are weird, and even her eyes look yellow.

The image is a screen cap from VirtualDub and shows the use of the ColorTools RGB histogram to analyze color problems. It's obvious that the Red channel is overextended, and blue looks crippled. The ColorTools VirtualDub plugin is found at doom9, but a caution: it'll crash VirtualDub in Windows 7.

The image below shows the same frame in the process of being color corrected in VirtualDub. In the Cher image you can see the Csamp pixel samplers' little dialog window being used to read color values. Note that CSamp's readout shows RGB pixel values wherever the desktop cursor is placed. At the left side of the picture is the Blue channel dialog of the Gradation Curves filter. Note the shape of the vertical line in that curves window: it's bowed upward and to the left, which raises Blue in the required amount and area, then sharply cut off at the top to avoid overrunning RGB 255. More adjustments were made later,especially lowering Red in the Red channel window. The Blue correction required was rather strong, mostly in the darks and midtones, tapering off toward the brightest end.

The last image is of the CSamp dialog tool, and a schematic showing how that vertical line works in gradation curves. Csamp is showing pixel values from the location, which was on Cher's nose. For most skins tones, this shows a high Red value and a ridiculously low Blue value. Her uncorrected skin tone is pumpkin colored.

In the gradation curve above, the vertical line is in the default position from lower left to upper right. The lowest point on the grid would be darks (RGB-0 values for luma, Red, Green, or Blue). The midpoint of the graph represents RGB 128. The top of the graph is RGB 255. Moving that vertical line to the right will darken the affected channel. Moving it to the left will brighten. Using an actual "S-curve shape", you can twist that line in such a way as to brighten darks and darken brights at the same time, or the reverse, or whatever you want. To get similar controls, you'd have to get Photoshop Pro, After Effects, Premier Pro, Vegas Pro, etc. Since you have Photoshop, you might be familiar with the curves filter.

Attached Images
Attached Files

Last edited by sanlyn; 05-26-2015 at 03:40 PM.
#40
05-26-2015, 10:05 PM
 sanlyn Premium Member Join Date: Aug 2009 Location: N. Carolina and NY, USA Posts: 3,648 Thanked 1,264 Times in 971 Posts
Post #39 above has an attachment of Avisynth plugins. Shucks, I already attached them earlier in post #38. What I meant to attach in post #39 was VirtualDub_filters.zip, see below.

It usually pays to take your sweet time correcting posts before clicking "Submit".

Attached Files