Log in

View Full Version : DVD Field Artifact Removal


thecoreyburton
9th October 2016, 12:32
Hey everyone! I need a bit of help clearing up a certain type of artifact (which looks like an interlacing or resolution issue). I'll start with an example to make my description a bit quicker:

An example of a good frame:
http://i63.tinypic.com/2iidagm.jpg

An example of a bad frame:
http://i63.tinypic.com/21a9w00.jpg

I've come across a bunch of DVDs that appear to have this sort of artifact. Some are NTSC, some are PAL, some are telecined, progressive, interlaced - there doesn't seem to be a common factor in the material itself. To me, it looks like they've been badly deinterlaced somewhere down the pipeline before release and I'm looking to clear up some of that.

Here's the file in question. (http://www.mediafire.com/file/mmr023q99wlh26d/Field_RAW_Doom9.rar)

I've tried a fair few combinations of filters so far to varying results. QTGMC's InputType does a good job of hiding the artifact, but there's a sort of "pulsating" going on between the the frames that were problems. Not only that, but the characters mouths start to show some ghosting when they're talking between frames. QTGMC's FPSDivisor is a much better (but much slower option). It hides the artifacts a little worse compared to the first option, but there's little-to-no ghosting present on the mouths and provides the most watchable experience I've had so far. I've tried a couple of resizing scripts I've made myself, involving ditching fields and stretching the video back up - but the results were not nearly as crisp as my prior attempts.

Here's my current script. I've IVTC'd the clip (and deinterlaced any remaining interlaced frames with QTGMC), then decimated the frame rate. The cropping values are general values (as it's a series DVD I'm ripping, these are the values for the entire season); there are also filters to remove any ringing and rainbows that are present in most of the scenes.

DGDecode_MPEG2Source("cp_01.d2v", cpu=6, info=3)
TFM(mi=30,pp=2,clip2=QTGMC(Preset="Very Slow",FPSDivisor=2))
TDecimate()
DeRainbow()
Crop(16,8,-16,-8)
HQDering(smoother=deen("a3d",1,9,2,2))
Spline64Resize(720,540)

It's just the base script though, it does nothing for the artifacts I mentioned earlier. Has anyone got any idea or has anyone had experience with these sort of things?

feisty2
9th October 2016, 12:49
see what happens with tfm(pp=0)

thecoreyburton
9th October 2016, 14:49
It's still present, the only difference is now the non-field-matched frames are now not de-interlaced in the relevant parts of the full source.

To elaborate a little more, the issue plagues consecutive frames and the frames almost never have any sort of interlacing to begin with. It's almost as if those specific frames were saved at a lower resolution and later rescaled up to the size of the rest of the source before release. My script is irrelevant to the issue for the most part and is just for cleaning up the rest of the source.

feisty2
9th October 2016, 15:05
MFlowInter

thecoreyburton
9th October 2016, 15:23
I'm not familiar with how to use MFlowInter. I'll look up the guides / descriptions and see if I can wrap my head around it and work it into my script and see if it helps!

Do you happen to have an example of it's usage or starting point for me to work from? If not, that's okay and I'll go off whatever I read but a place to start might be helpful!

Also, thank you for both of your suggestions so far, feisty2!

feisty2
9th October 2016, 15:33
http://www.avisynth.nl/users/fizick/mvtools/mvtools2.html#examples

AVISource("c:\test.avi") # or MPEG2Source, DirectShowSource, some previous filter, etc
super = MSuper()
backward_vectors = MAnalyse(super, isb = true, delta=2)
forward_vectors = MAnalyse(super, isb = false, delta=2)
inter = MFlowInter(super, backward_vectors, forward_vectors, time=50, ml=70)
# Assume bad frames are 50 and 60
trim(0,49) ++ inter.trim(49,-1) \
++ trim(51,59) ++ inter.trim(59,-1) ++ trim(61,0)

ChiDragon
9th October 2016, 18:18
Weird sample.


The pulldown pattern is not 3:2.
The entire source appears vertically corrupted somehow.
There are dropped frames -- tons of them at the end of the plane shot. But they are near-dupes rather than exact. Therefore they used a TBC with analog outputs in the processing chain. If you watch that plane shot with just SeparateFields you can see the clouds jump back and forth as a result of these drops. Because they are frame drops not field drops, the motion goes [forward1 forward2] [backward1 forward2] [forward3 forward4].
At frame 168 there is a scene change. For two frames the guy's hair is orange like the previous shot, then at 170 it abruptly switches to a more yellow hue as the frame shifts vertically.


SeparateFields().Trim(1,0).Weave() can be thought of as forcing a "P" match in TFM. It fixes certain frames while breaking others. TFM is breaking a lot of frames in the source by guessing a "P" match when "C" would be combing-free and not aliased.
http://imgur.com/a/JymRn

thecoreyburton
10th October 2016, 09:39
Thank you both. I did quite a few tests with MFlowInter for the whole duration of the clip (as singling out frames in an entire series is too much of an impractical task) and did a few side-by-side tests with and without TFM and with things I've seen, comparisons I've made and other things I've played around with I have managed to greatly improve the source.

DGDecode_MPEG2Source("cp_01.d2v", cpu=6, info=3)
DeInt=Last.QTGMC(preset="Faster",FPSDivisor=2)
ConditionalFilter(Last,DeInt,Last,"IsCombedTIVTC(mi=30)","=","True")
TDecimate()
QTGMC(FPSDivisor=2, Preset="Very Slow",TR2=3)
DeRainbow()
Crop(16,8,-16,-8)
HQDering()
Spline64Resize(720,540)
DeGrainMedian()
LimitedSharpenFaster(strength=10)

That's my current script at the moment. It's a little slow, but it gives pretty smooth results. The only catch is slight ghosting in the more subtle animations and a pulsing effect between the good and bad sections of the frames. That being said, both of these effects are much more subdued compared to any of my earlier attempts, and watching with these problems is a much better experience than watching with the source's original problems. With the over-temporally smoothed look the clip now has, it's a matter of deciding which clip (original or the output) is the greater evil.

I'm not sure if there are any further ways to improve the source more or tweak the script to make it more effective and give less distortion whilst still clearing up most of the problems, but it's looking a lot nicer at this point.

ChiDragon
10th October 2016, 10:38
With the over-temporally smoothed look the clip now has, it's a matter of deciding which clip (original or the output) is the greater evil.
Is the smoothing necessary to kill the field problems or are you denoising it as well?

thecoreyburton
10th October 2016, 10:56
I'll likely be denoising it too, but I think the smoothing is necessary. I'm doing a few tests with repair and a few other functions and plugins at the moment. You'll have to ignore some of the unnecessary filters in the following script, I'm just playing around with things and looking at the results and trying to think outside the box. I've managed to fix a lot of the ghosting that was present in the earlier clips and a cull a fair bit of the over-temporally smoothed sections from before. The clip still looks a bit washed out, but that's thanks to the abundance of denoising hell it's gone through so far. The theory behind the idea is that I can smooth out the artifacts, use an edge-based or line-based filter to remove any imperfections, then use a repairing method to re-introduce a portion of the original footage (prior to smoothing) over the top. Hopefully that'll give the clip all the character that the smoothing process took away, without reintroducing the problems to such a severe degree. Here's an encode (http://www.mediafire.com/file/hzdtcksgkz219o6/cp_test_2-1.mkv), and the script I used:

DGDecode_MPEG2Source("cp_01.d2v", cpu=6, info=3)
DeDot()
DeInt=Last.QTGMC(preset="Faster",FPSDivisor=2)
ConditionalFilter(Last,DeInt,Last,"IsCombedTIVTC(mi=30)","=","True")
TDecimate()
DeRainbow()
BasicClip=Last
BasicClip.QTGMC(FPSDivisor=2, Preset="Very Slow")
Crop(16,8,-16,-8)
HQDering()
Remation(xres=720,yres=540,dQuant=10,dBlur=3,shrpstr=250,linestr=0.3)
ProcessedClip=Last
UnprocessedClip=BasicClip.Crop(16,8,-16,-8).Spline36Resize(720,540)
Repair(ProcessedClip,UnprocessedClip,1)
FastLineDarkenMod()

Still could refine some of the plugins and tidy up the script, but at least I've found some sort of mid-ground between the two "evils" I mentioned before. The video itself still has an over-filtered look to it, but when you compare that to what we had to begin with, I'm happy with how this is progressing.

Edit: Remation is a restoration script by Sagekilla, which can be found here. (http://forum.doom9.org/showthread.php?p=1091251#post1091251)

ChiDragon
11th October 2016, 01:46
Looks like the color in general has been destroyed in addition to detail.

I wonder if you could determine the actual frame rate. It stutters twice during that final panning shot due to dupe frames.

GMJCZP
11th October 2016, 03:23
Try AnimeIVTC(mode=3). It's your simplest solution for this problematic source.

thecoreyburton
11th October 2016, 05:52
Looks like the color in general has been destroyed in addition to detail.
Yeah, not the look I was going for. I'm happy I got rid of the artifacts but in doing so I got rid of any ounce of detail as well.

I wonder if you could determine the actual frame rate. It stutters twice during that final panning shot due to dupe frames.
I was thinking along those lines and considering using SRestore. The problem is the inconsistency. Sometimes sections are almost certainly 23.976fps and there are no duplicates, I have a feeling that it's the correct rate. I can get a few more samples if you'd like. This is actually the new Australian release so I was shocked when the disk was NTSC. It looks like they've grabbed a properly telecined NTSC source, detelecined it incorrectly and then left it (for the most part) with an abcddabcdd pattern. The frame artifacts, frequent inconsistencies and the interlaced frames here and there suggest they rushed it or didn't know what they were doing. I could be wrong, but that's the impression I've been getting as I've been working with it.


Try AnimeIVTC(mode=3). It's your simplest solution for this problematic source.
It definitely is the simplest solution, although it leaves the video looking a little bit jumpy (with several frames being out of order) and the artifacts are smoothed but still very noticeable. I'm glad it doesn't destroy as much detail as my script and I might play around with some of the additional settings to see if I can get a better result.

Also, on the off-chance that anyone else has a copy of the DVD from a different release and wants to compare the scene in question, it's at roughly 9:40 in the first episode.

Edit: After going through most of the episodes in full, it turns out there are dropped and duplicate frames all over the place. There are 24fps sections that half the last frame duplicated (in the sense of abcdd) and there are traditionally telecined sections with two interlaced frames (a, b, cd, de, e). I've updated and adjusted the script to produce clean results no matter what the source is throwing at it. It still in it's over-filtered state (I'm working on an alternative to Remation that will hopefully be as effective but retain more detail), but prior to this adjustment there were sections which deinterlaced to become a blended mess.

DGDecode_MPEG2Source("cp_01.d2v", cpu=6, info=3)
Checkmate(thr=9, max=9, tthr2=0)
ChubbyRain2(Interlaced=True)
StartingClip=Last

StartingClip.QTGMC(Preset="Very Slow")
Crop(16,8,-16,-8)
HQDering()
Remation(xres=720,yres=540,dQuant=10,dBlur=3,shrpstr=250,linestr=0.3)
Spline36Resize(720,540)
ProcessedClip=Last

StartingClip.QTGMC(Preset="Faster")
Crop(16,8,-16,-8)
Spline36Resize(720,540)
UnprocessedClip=Last

Repair(ProcessedClip,UnprocessedClip,1)
TDecimate(mode=1, cycleR=3)
FastLineDarkenMod()