Log in

View Full Version : "horizontal colored segments" noise?


sanzoghenzo
16th October 2012, 20:54
Forgive me if it's already discussed, but I cannot find the name of this odd behavior (and thus use de correct search keyword).

I captured some VHS with my philips DVD/VCR player DVP3350 hooked via composite (a 0.75 16AWG noiseless cable with quality connectors) to my old P4 2,4GHz, 2GB ram, radeon 9000 VIVO 64MB Ram.

I noticed weird horizontal colored segments that moves around the screen, like some interference.
Here's a sample (https://dl.dropbox.com/u/671039/sample.avi)

I tried to defreq, fft3dfilter and cnr2 with little to no improvements.
Then I remebered that a similar pattern appears when there's nothing hooked to the VIVO card (see here (https://dl.dropbox.com/u/671039/not%20connected.avi)), or even if the VCR is off (sample here (https://dl.dropbox.com/u/671039/VCR%20off.avi)).
Turning on the VCR gives me a blue screen with some lines brighter than others and continuos "interference" in chroma channels (visible with UtoY or VtoY here (https://dl.dropbox.com/u/671039/VCR%20ON.avi))

I'm new to Avisynth and it gave me some headaches these days :) Is there a way to get rid of this "noise"?
Unfortunately buying superior gears is not an option for me, so If there's no way to fix it via software I'll have to live with that.

Thanks in advance to all of you!

Mounir
17th October 2012, 00:12
I don't know what's causing this but you should try camcorder color denoise first then Nlmeans if you want even more denoising

original:
http://imageupload.org/getfile.php?id=242600&a=7e411ce8f85cf8bf33d5ea9dc76810c0&t=507dea67&o=29D09792C86EE701F5C55CA674DC739B2CC9C593C974E14FEAC433E034976FE256D0968EC86E&n=frame_227-og.jpg&i=1

new (ccd only):
http://imageupload.org/getfile.php?id=242601&a=e2e764248c0a50f26880614a7113785b&t=507dea86&o=700C721D1D940A061F59B1886728FA4B741321181B805B1E0058DECE2763E6320F0C73011D94&n=frame_227-new.jpg&i=1

script

AVISource("C:\Users\lin\Desktop\sample.avi")
assumetff()
pointresize(last.width, last.height).converttoRGB32(matrix="rec601",interlaced=true).pointresize(last.width, last.height)
separatefields()
CCD(30,1)
weave()
pointresize(last.width, last.height).converttoyv12(matrix="Rec601",interlaced=true).pointresize(last.width, last.height)
# Denoise UV with Nlmeans gpu:
#NLMeansCL(A=4, S=2, B=1, aa=1.0, h=1.1,HC=4.5, plane=3,cpu=false,buffer=false,sse=true)
Crop(150, 138, -250, -186)
pointresize(last.width*2, last.height*2)

sanzoghenzo
17th October 2012, 19:40
I don't know what's causing this but you should try camcorder color denoise first then Nlmeans if you want even more denoising


I think I can get rid of those "pointresize" instance without any problem, isn't it?
The funny thing is I switched from virtualdub to avisynth to avoid YUY2->RGB->YUY2 conversions.. I think I have to live with that :)

Thanks, most of noise is gone. But lines still remain: where I should get a plain color I got horizontal stripe patterns. It's still a chroma channel issue because grayscale shows only other kind of noise (a inclined interference on objects borders), and utoy shows "stripes".
A simple blur(0,0.5) solves most of the problem, at cost of a small definition loss.
I didn't use nlmeans because I'm with a mac, running vdub/avisynth under wine, and I didn't find time to mess with .net :P Should this plugin do the work?

Mounir
17th October 2012, 21:25
yep it will remove more without noticeable artifacts, otherwise use fft3dfilter... and forget the blur

Mini-Me
23rd October 2012, 00:59
I get the same artifacts with my YUY2 VHS captures too, depending on which VCR I use. It's funny, because I used to go through a lot of trouble to keep the full YUY2 chroma resolution as long as possible, but throwing it out is a quick, dirty, and surprisingly effective solution. Try this:

fixed = original.ConvertToYV12(interlaced = True)

Actually, I use YUY2ToYV12_26(interlaced = True), as found here (http://forum.doom9.org/showthread.php?p=1471623#post1471623), because it does the resampling more accurately. By the way, if you preview using Virtualdub, make sure you convert back to YUY2 first, because Virtualdub upsamples interlaced YV12 incorrectly.

Update: I just tried with your video, and simply converting to YV12 does fix your problem. :) The results were different between ConvertToYV12 and YUY2ToYV12_26, so you may want to try both yourself, but I found Gavino's version to more accurately match the underlying color and leave behind fewer color blobs, especially on the woman's white shirt in close-up shots midway through the video. Note that Gavino included Avisynth 2.5 versions in the linked thread above too. Also, remember to set interlaced = True, both when converting to YV12, and if you convert back to YUY2.

For reference, I would avoid Blur(0, 0.5) on interlaced images, because it will irrevocably blur information from completely different fields. If you wanted, you could do fixed = original.SeparateFields.Blur(0, 0.5).Weave.MergeLuma(original), because it will blur only the chroma, and only within the correct field...but a simple YV12 conversion should do a better job in your case. If you decide to do something else, keep in mind that you can always use MergeLuma to restore the original luminance channel.

Fixing these artifacts through spatial blurring (including the YV12 conversion) will still leave behind faint lower-frequency blobs of color. If that bothers you, you can use Avisynth denoising filters like MCTemporalDenoise to get rid of random color blobs, and a number of filters should do a good job of it. (I haven't found one yet that eliminates lower-frequency noise quite as well as Neatvideo though.) They won't eliminate color bleed from brightly colored objects though (like the man's teal shirt at the beginning), even if they help tone it down. You might consider this ridiculously wasteful, but if you're desperate, you could always just use fixed = original.YUY2ToYV12_26(interlaced = True).MCTemporalDenoise(settings = "high").YV12ToYUY2_26(interlaced = True).MergeLuma(original) if you want to do extra-strength processing on the chroma channel alone. ;) It would be less wasteful to save this kind of processing for a stage where you're ready to denoise the luma too though.

As a side note, I wouldn't expect the NLMeans algorithm to help much here, because of the way it works: It averages pixels or blocks with other ones within the search radius based on the similarity of surrounding pixels. This works well for uncorrelated high-frequency noise, but it doesn't work well for lower-frequency blobs, and it probably won't work well for strong horizontally correlated line patterns either...although I suppose it depends on how NLMeans handles chroma. (If it averages chroma samples based on the results of a luma analysis, it might help, if not consistently...but if it analyzes chroma separately, it won't help much, because the pixels with most similar chromatic neighbors to other "line artifact" pixels will usually be other "line artifact" pixels of the same color.) Try TNLMeans on the YUY2 input if you want to see what I mean. The faster NLMeansCL only takes YV12 input, and once you have that, your lines should be gone...but I don't expect it to help with blobs either.

Mounir
23rd October 2012, 01:05
mergeluma only affect the chroma ? you lost me there

Mini-Me
23rd October 2012, 01:14
mergeluma only affect the chroma ? you lost me there

It depends on argument order. Running fixed.MergeLuma(original) after running your other filters will get your original luma channel back but keep the filtered chroma. You can do the same thing with MergeChroma though too, e.g.:
original = Avisource("blahblah.avi")
denoised = original.MCTemporalDenoise()

# fixed1 = fixed2; both change only the original clip's chroma
fixed1 = denoised.MergeLuma(original)
fixed2 = original.MergeChroma(denoised)
diff = Subtract(fixed1, fixed2) # Should show zero difference
return Interleave(original, denoised, fixed1, fixed2, diff)

sanzoghenzo
27th October 2012, 23:05
hi, thanks for your replies.
YUY2ToYV12 seems to work well, but I have to use CCD anyway to make chroma channels look better.
here's my script so far:

LoadVirtualDubPlugin("C:\Program Files\VirtualDub\plugins\CCD_sse2.vdf","CCD",0)
source=AVISource("Sample.avi").killaudio()
source.assumetff()
YUY2ToYV12(interlaced=true)
converttoRGB32(interlaced=true).CCD(30,1).convertToYV12()
separatefields()
chromashift(c=4,l=-2)
weave()
I still got some noise on the luma channel: If you look at borders or shadows (ie the lower part of the left arm of my aunt :), the belt of my dad, the borders of the red chair), there are diagonal segments (separatefields and some adjustment in brightness/contrast will make them look more visible) that I cannot clean. I've tried with Defreq with no success; fft3dfilter doesn't solve it completely even with sigma=9). Some hint?
thanks a lot guys!!

Mini-Me
1st November 2012, 02:18
hi, thanks for your replies.
YUY2ToYV12 seems to work well, but I have to use CCD anyway to make chroma channels look better.
here's my script so far:

LoadVirtualDubPlugin("C:\Program Files\VirtualDub\plugins\CCD_sse2.vdf","CCD",0)
source=AVISource("Sample.avi").killaudio()
source.assumetff()
YUY2ToYV12(interlaced=true)
converttoRGB32(interlaced=true).CCD(30,1).convertToYV12()
separatefields()
chromashift(c=4,l=-2)
weave()
I still got some noise on the luma channel: If you look at borders or shadows (ie the lower part of the left arm of my aunt :), the belt of my dad, the borders of the red chair), there are diagonal segments (separatefields and some adjustment in brightness/contrast will make them look more visible) that I cannot clean. I've tried with Defreq with no success; fft3dfilter doesn't solve it completely even with sigma=9). Some hint?
thanks a lot guys!!

I see what you mean. These kind of artifacts are difficult to process using typical noise removal filters. NLMeansCL won't do it, MCTemporalDenoise(settings = "very high") won't do it, and there isn't a large enough example to create a Neatvideo profile from. Since the noise only appears in some parts of the frame, trying to precisely eliminate the exact noise frequencies with DeFreq and FFTQuiver would damage the rest of the image too, unless you just used them as a low-pass filter.

Funny enough, the best filter solution I've found is a very simple horizontal blur:
orig = Avisource("sample.avi", pixel_type = "YUY2").AssumeTFF()
fixed = orig.YUY2ToYV12_26(interlaced = True).mt_convolution("1 1 1", "1", u = 3, v = 3)
resharpened = fixed.mt_convolution("-2 9 -2", "1", u = 3, v = 3)

fixed = fixed.YV12ToYUY2_26(interlaced = True)
resharpened = resharpened.YV12ToYUY2_26(interlaced = True)

#return Interleave(orig, fixed, resharpened)
return resharpened

TA-DA! This particular blur seems to eliminate the artifact entirely...and since your source doesn't seem to have any legitimate high frequencies, it doesn't seem to do any irreversible damage by eliminating any actual detail, either. My first thought was to use a "1 2 1" kernel, but "1 1 1" works better for some reason. It does soften things a bit, but it eliminates the stippling artifacts well enough that you can resharpen everything else afterwards without bringing back the stippling. (EDIT: Actually, I just did exactly that and modified the script accordingly.) Give it a try and see what you think (interleave the source with the result for a close-up comparison). If you had no problem using something as rough as FFT3DFilter, I have a feeling you'll like the results. :p

That said, the artifact looks digital in nature, so I doubt it's actually on the tape. Instead, I believe it was probably created during the capture process by the circuits in your DVP3350, or less likely, your capture card (I have an AIW 9600 SE, and while I do get the horizontal colored lines with YUY2 capture, I don't get anything like your stippling artifact). If you hesitate to apply a simple blur like above, you can always try using another VCR, and the problem will probably go away that way too.

Besides, the VCR you use for your transfer will have a bigger impact on the quality of your captures than anything else, so if the tapes mean a lot to you, it's worth testing out another one to see how it compares. If you have a LOT of important tapes to transfer and you're up for throwing away your life savings on them, there are a number of VCR's that are well-regarded for digitization. If you care mostly about having decent tracking and a smooth, clean SP picture right out of the box, the JVC and Mitsubishi D-VHS models are a good bet (except for the JVC HMDH-30000U, which has overheating problems), because they give a similar picture to the old JVC S-VHS machines without being riddled with transport problems. If you'd rather get the most detail you can off the tapes without sharpening or DNR artifacts (assuming you'll denoise later in software), it's more like finding the holy grail. Pro machines can be very good for this, and I've had great luck with the Sony SVO-5800 (SVP-5600 playback-only deck would work too) in Edit mode for my home movies. However, they only work for SP tapes, and their audio is terrible for consumer-recorded tapes in my experience. The JVC SR-W5U/SR-W7U W-VHS machines are also great for this purpose, and they can play EP tapes too, but they're extremely expensive and hard to find, especially in working condition...and fixing broken ones is prohibitively expensive. I have a W7U with all kinds of problems, and the transport stopped working soon after I finished my EP tapes (it's a stroke of luck that I got them captured in time, but there are still times when I'd like to use that deck...). Still, my W7U's detail was almost as good as my SVO-5800 for SP tapes, and while its detail was nothing special for EP tapes, it made up for that by being the only VCR I've found that actually makes EP tapes look clean (and cleaning EP tracking artifacts/gunk/coarseness in software isn't fun at all). I hear the Sony SLV-R1000 has detail that approaches both of those two decks, but it's hard to find one without worn heads, and I've never used one myself. It also doesn't have any built-in TBC functionality, but...yeah. Anyway, I just thought I should mention the importance of VCR's, since your artifact seems like it may be coming from the one you're using.

sanzoghenzo
1st November 2012, 15:41
Thank you so much Mini-Me!
I red about VCRs in many other posts and forums, I know I should use a better one but it's all I can afford now.
It's not a big problem though, my family can live with low quality video as we did before :)
I'll investigate for possible electrical interferences in my setup for future acquisition.

Thanks again,
cheers from italy