Sorry for the delay. Bad storm here, no phone or internet yesterday or today. Working now from a Starbucks from my laptop, but it's so sloooooow for posting.
Quote:
Originally Posted by JPMedia
sanlyn, can you share the script you wrote to implement these corrections?
|
Problems with garbage like CMOS noise (as in the posted sample), herringbone, RF hum bars, and all that horrible stuff are tough because they use very destructive filters and aren't 100% fixable. I'm guessing that the report from the original post on how well NeatVideo behaved was based on NV's default settings, which turns video into jelly. I give the owner the benefit of the doubt, since I use NeatVideo myself at times, never at default settings. But it would have been nice to see a sample of their results.
I experimented for a while on the original test1.avi sample with several filters. That RGB conversion made things tricky especially with the right-border orange stain, which I didn't address except with QTGMC's chroma filter setting (which wouldn't help much anyway but which did help a bit with some of the red chroma smearing). The tape player didn't help with serious glitches like edge ghosts and linescan timing artifacts (see the door frame wiggles at the left side and lower right, and notches in the right border). Deinterlacing with QTGMC's EZDenoise and raising TemporalDeGrain's sigma parameter also helped -- but note that settings like these over-smooth everything. I had to apply those slow filters in two separate scripts. Because the sample is so short I also had to add a string of duplicate frames to the beginning and end of the clip in order to give temporal filters something to work with during the start and end frames. You'll note in all attached versions that a few start and end frames are not as filtered as frames in between. This is one disadvantage of very short badly photographed samples.
Also, I first posted an image of my results in post #11. One of the filters I used was a medium-strength MCTemporalDenoise (MCTD). I think it definitely smoothed a bit much and likely would cause ghost trails on fast motion. So I replaced MCTD with a lightweight NeatVideo v.3 at very easy settings -- still a bit more smoothing than I'd like but less than MCTD. If NeatVideo isn't available you can try two instances of
Virtualdub's FSN 3.67.1 filter. Use the first instance at default settings and the second instance in the chain at about 1/3 strength. The Russian FSN.ndf filter (for "Frequency Suppressor of the Noise") by Sergey Stolyarevskiy is in FSN.zip at
http://www.infognition.com/cgi/getfilter?id=137. You'll see it used here and elsewhere in several past projects.
There's no telling what these scripts would do in a longer segment or scenes with better lighting. I can understand why the owner posted such a short segment due to size concerns, but that's because of the conversion to RGB (Unintended, I hope). The original upload file size in uncompressed RGB was 25.5 MB, but in
huffyuv YUY2 it would have been just under a tiny 8 MB. It also could have had less bright detail blowout in the center where the child is holding something. We'll never know unless we can see a chunk of the original unaltered colorspace.
The first script ("Step1") fixed levels and contrast, worked on edge halos and chroma bleed, and used QTGMC to denoise and work on shimmer and to deinterlaced the video to full-frame 59.94 fps. For later work and multiple final encodes, I saved Part1 to lossless progressive Lagarith YV12 as "test1_Part1_QTGMC_59.94p.avi".
Here is the script for Part 1:
Code:
AviSource("D:\forum\faq\theodore1\TEST1.avi")
ConvertToYUY2(interlaced=true) ### <--- Input sample .avi is RGB --- ###
AssumeTFF()
SeparateFields()
FixVHSOversharp(20,16,12)
FixVHSOversharp(20,8,4)
FixVHSOversharpL(20,12,8)
FixChromaBleeding()
WeaVE()
ColorYUV(off_y=-15)
Tweak(cont=1.1,Sat=1.35,dither=true,coring=false)
Levels(16,0.95,255,16,250,dither=true,coring=false)
ConvertToYV12(interlaced=true,ChromaOutPlacement="MPEG2")
QTGMC(preset="faster",EZDenoise=6,denoiser="dfttest",ChromaMotion=true,\
border=true,ChromaNoise=true,DenoiseMC=true,GrainRestore=0.3,sharpness=0.7)
vInverse2()
MergeChroma(aWarpSharp2(depth=40).aWarpSharp(depth=20).aWarpSharp(depth=10))
Return last
### --- Save VDub output as "fast recompress" --- ###
### --- for Lagarith or UT Video YV12 & Part2 --- ###
The script for Part2 uses Part1 as input. It deletes the first 2 frames from the original and adds a few duplicated frames at the start and end as described earlier. It uses TemportaldeGrain as the main denoiser (I removed the additional MCTemporalDenoise). The script uses Santiag to help smooth ragged edges, Bifrost for chroma noise, and AddGrainC for very fine film-like grain to combat color banding and clay-face filter effects. The results might need more anti-posterizing tweaks but a longer sample is needed to see if that's the case. Before closing, the script cleans bad borders and centers the image, then converts to RGB32 for the
VirtualDub filters that I applied to the script's output. Finally it extracts the main video from the eralier start and end frames.
Note at this stage that output is still deinterlaced. It was saved as lossless lagarith Yv12.
Code:
UnTrim=AviSource("D:\forum\faq\theodore1\test1_Part1_QTGMC_59.94p.avi")
### --- Delete first 2 frames and join some --- ###
### --- duplicated frames at start and end --- ###
### --- to "prime" temporal filters. --- ###
v1=UnTrim.Trim(2,11)
V2=Untrim.Trim(2,49)
V3=UnTrim.Trim(2,9)
Trimmed=V1+V2+V3
Trimmed
TemporalDeGrain(SAD1=400, SAD2=300, Sigma=16)
santiag(2,2)
Bifrost(interlaced=false))
AddGrainC(1.5,1.5)
Crop(8,0,-22,-8).AddBorders(14,4,16,4)
### --- To RGB32 for VirtualDub filter chain.--- ###
ConvertToRGB32(interlaced=false,matrix="Rec601",)
### --- Trim for extracting video from dupes.--- ###
Trim(10,57)
Return last
### --- Save VDub output after filtering as YV12 using --- ###
### --- "fast recompress" for later processing & coding.--- ###
The VirtualDub filters I used were
ColorCamCorderDenoise, exorcist anti-ghost plugin (attached),
ColorMill, and 32-bit NeatVideo v.3 (you can substite that with FSN.vdf, as described earlier). I saved the VirtualDub filter settings as VirtualDub_settings.vcf (attached). To use a .vcf file, click "File..." -> "Load processing settings...", then locate and open the .vcf file. You must have the 4 VirtualDub filters in your plugins folder. If you don't have NeatVideo but want to use the FSN.vdf filter and add builtin temporalsmoother at a setting of 3, an alternate vcf is attached as VirtualDubsettings2_FSN.vcf (attached). VCF files are simple text files that you can open and read with any text editor. Keep vcf's with your project folder, don't keep them in the VDub plugins folder.
This isn't a fair test for NeatVideo which requires noise samples for best results. I used NV_recent profile.dnp, a noise profile from another video with similar CMOS noise. For the noise filtering strengths I borrowed another lightweight preset, NV_default preset D2L.nfp. The dnp and nfp files are attached as NeatVideo_presets.zip. The presets can be used with almost all recent 32-bit NeatVideo versions.
The results of the Part2 script and VirtualDub filters were saved as "test1_Part2_TDG_59.94p.avi". It's attached as A_test1_Part2_TDG_59.94p_LagarithYV12.avi, losslessly compressed with Lagarith YV12. VLC Player and several other PC players will play Lagarith compression, but if you want or need the free codec and handy installer it's at
https://lags.leetcode.net/codec.html.
test1_Part2_TDG_59.94p.avi was then used to output three final output formats, described below:
The script below outputs Part2 as 59.94fps progressive video resized to 640x480 (4x3) square- pixel for internet posting or for PC or external media player or smart-tv (especially since many smart-tv's are too stupid for anamorphic formats). Audio is 44.1khz for the internet. The result is attached as B_test1_59.94p_4x3.mp4
Code:
AviSource("D:\forum\faq\theodore1\test1_Part2_TDG_59.94p.avi")
### --- Input file was saved as YV12 from VirtualDub --- ###
ConvertToYUY2(interlaced=false,ChromaInPlacement="MPEG2",matrix="Rec601")
Spline36Resize(640,height)
### --- Convert To YV12 for final encoding in h.264 --- ###
ConvertToYV12(interlaced=false,ChromaOutPlacement="MPEG2",matrix="Rec601")
return last
The script below outputs Part2 as "normal" 29.97 physically interlaced for DVD (similar encoding can be used for SD-BluRay). The interlace combing can look ugly in some systems, thanks partly to the tape player but mostly to the typically sloppy interlacing by consumer camera shutters designed for CRT's. On an LCD it can be a disaster, but not always (looks OK on mine). The results are attached as C_test1_normal_29.97i_DVD.mpg
Code:
### --- Input file was saved as YV12 from VirtualDub --- ###
AviSource("D:\forum\faq\theodore1\test1_Part2_TDG_59.94p.avi")
AssumeTFF()
SeparateFields().SelectEvery(4,0,3).Weave()
return last
### --- Save VDub output as "fast recompress" for YV12 & MPEG encoding --- ###
The script below is a common solution for excess combing and bad interlace: discarding alternate frames in a 59.94fps progressive video to produce a 29.97fps video that is physically progressive but encoded for DVD or Bluray with imbedded interlace flags (aka "fake interlace"). Yes, it does discard 50% of the temporal resolution. Fast motion and long pans are not as smooth as interlaced. Purists will scream and faint, but most viewers will just say it looks less noisy. Encoding bitrate is 6500 VBR (8500 max). You could use higher bitrates for SD-Bluray. The results are attached as D_test1_29.97p_Interlace_Flagged.mpg.
Code:
### --- Input file was saved as YV12 from VirtualDub --- ###
AviSource("D:\forum\faq\theodore1\test1_Part2_TDG_59.94p.avi")
SelectEven()
return last
### --- Save VDub output as "fast recompress" for YV12 & DVD encoding --- ###
It would be more interesting to see how the owner's effort turned out.