View Full Version : Transition Combing issues with IVTC
Reclusive Eagle
2nd November 2021, 22:57
Ok so I figured out what was going wrong with my IVTC.
The IVTC works fine. However. If I put NNEDI3 or nnedi3cl_rpow2
before the IVTC this results in the transition having combing issues.
But If I put NNEDI3 or nnedi3cl_rpow2 after IVTC then the transition itself is aligned but the frames the transition, transitions into, are unaligned until the transition passes.
If that makes sense
The issue is transition frames.
It seems whenever a new transition is about to take place, the transition interlacing is aligned differently to the image interlacing.
What do I mean? Here is an example:
https://imgsli.com/Nzk5Mjk
So when a transition frame comes the frames the transition blends into align to the wrong field?
While the transition frame is aligned to the correct field.
Then after the transition completes the frames realign to the correct field.
Here is another example.
https://imgsli.com/Nzk5MzA
And if you still don't understand what I am saying, because quite frankly I'm still confused why this is happening.
Here is a video demonstration:
https://drive.google.com/file/d/15ivbve5RjpgyblbQWDMqTgSdXV0KYEbA/view?usp=sharing
Download the video. Its much clearer than the preview.
Here are the 2 Transition Samples for your own testing:
https://drive.google.com/drive/folders/1w3vXK_rYFGSvp6hgAUBwefexAen4n8Zr?usp=sharing
poisondeathray
3rd November 2021, 02:17
It's an interlaced transition . The content underneath is progressive, but the wipe was applied on an interlaced timeline by the editor, so it runs at 59.94 fields/second
When TFM detects combing, it applies PP. Since the image underneath is progressive, it gets degraded because essentially 1 of 2 fields is used when you deinterlace (recall the conversation about deinterlacing progressive content in your other thread)
A slightly better way might be to use QTGMC for the PP, because the deinterlacing quality is generally higher. ie. Clip2. So whenever combing is detected , it applies "clip2" . Whenever combing is not detected, TFM functions normally as a field matcher, so you get full quality assuming source is decent and correct matches are found
To debug the thresholds, you can use display=True to toggle the display, to see if PP is being applied on that frame , and adjust the settings if required . Full documentation is in the avisynth version of TIVTC, but the vpy version does not have all the settings ported
.
.
deint = haf.QTGMC(clip, Preset='slower', TFF=True)[::2]
clip = core.tivtc.TFM(clip, clip2=deint, display=True)
.
.
If we talk cadence only for now - if you fieldmatch/decimate it to 23.976 - the wipe transition will be jerky. 29.97 will be relatively smooth for that section. 59.94 will be perfectly smooth. In order to express different framerates in the same video you would need to make it VFR
ChaosKing
3rd November 2021, 08:27
For fades this filter could help https://vsdb.top/plugins/ftf
or use the FixTelecinedFades implementation from muvsfunc
Reclusive Eagle
3rd November 2021, 12:31
It's an interlaced transition . The content underneath is progressive, but the wipe was applied on an interlaced timeline by the editor, so it runs at 59.94 fields/second
When TFM detects combing, it applies PP. Since the image underneath is progressive, it gets degraded because essentially 1 of 2 fields is used when you deinterlace (recall the conversation about deinterlacing progressive content in your other thread)
A slightly better way might be to use QTGMC for the PP, because the deinterlacing quality is generally higher. ie. Clip2. So whenever combing is detected , it applies "clip2" . Whenever combing is not detected, TFM functions normally as a field matcher, so you get full quality assuming source is decent and correct matches are found
To debug the thresholds, you can use display=True to toggle the display, to see if PP is being applied on that frame , and adjust the settings if required . Full documentation is in the avisynth version of TIVTC, but the vpy version does not have all the settings ported
.
.
deint = haf.QTGMC(clip, Preset='slower', TFF=True)[::2]
clip = core.tivtc.TFM(clip, clip2=deint, display=True)
.
.
If we talk cadence only for now - if you fieldmatch/decimate it to 23.976 - the wipe transition will be jerky. 29.97 will be relatively smooth for that section. 59.94 will be perfectly smooth. In order to express different framerates in the same video you would need to make it VFR
I think I have things in the wrong order here.
Doing it like this:
deint = haf.QTGMC(clip, Preset='slower', TFF=True)[::2]
clip= core.tivtc.TFM(clip, order=1, field=-1, mode=2, PP=7,micmatching=3)
clip=core.nnedi3.nnedi3(clip, field=1, dh=True, nsize=4, nns=4, qual=2, etype=0, pscrn=2,exp=2)
clip = core.resize.Lanczos(clip, 720,480)
clip = core.tivtc.TFM(clip, clip2=deint, display=True)
clip.set_output()
Results in nothing changing. Because tivtc is making the frames progressive so all frames are considered clean before your fix.
Resulting in degraded quality continuing to be shown.
_______________________________________________________________________________________________
Putting NNEDI3 above TFM works but there are issues:
deint = haf.QTGMC(clip, Preset='slower', TFF=True)[::2]
clip=core.nnedi3.nnedi3(clip, field=1, dh=True, nsize=4, nns=4, qual=2, etype=0, pscrn=2,exp=2)
clip= core.tivtc.TFM(clip, order=1, field=-1, mode=2, PP=7,micmatching=3)
clip = core.resize.Lanczos(clip, 720,480)
clip = core.tivtc.TFM(clip, clip2=deint, display=True)
clip.set_output()
P frames are still combed. Example:
https://imgsli.com/Nzk5ODI
Obviously at this point its still 29.97 fps because I haven't decimated. However, is there a way to decimate or get rid of P frames?
This would solve the issue. Or are P frames required?
Everything else is C frames and P frames are the only frames with combing issues now.
Edit: P frames also seem to be the only frames above a mic of 10 without sRestore.
I can also get P frames to change to n frames with field 0 in tivtc. But M-N decimation mode doesn't decimate them...
Reclusive Eagle
3rd November 2021, 13:56
It's an interlaced transition . The content underneath is progressive, but the wipe was applied on an interlaced timeline by the editor, so it runs at 59.94 fields/second
When TFM detects combing, it applies PP. Since the image underneath is progressive, it gets degraded because essentially 1 of 2 fields is used when you deinterlace (recall the conversation about deinterlacing progressive content in your other thread)
A slightly better way might be to use QTGMC for the PP, because the deinterlacing quality is generally higher. ie. Clip2. So whenever combing is detected , it applies "clip2" . Whenever combing is not detected, TFM functions normally as a field matcher, so you get full quality assuming source is decent and correct matches are found
To debug the thresholds, you can use display=True to toggle the display, to see if PP is being applied on that frame , and adjust the settings if required . Full documentation is in the avisynth version of TIVTC, but the vpy version does not have all the settings ported
.
.
deint = haf.QTGMC(clip, Preset='slower', TFF=True)[::2]
clip = core.tivtc.TFM(clip, clip2=deint, display=True)
.
.
If we talk cadence only for now - if you fieldmatch/decimate it to 23.976 - the wipe transition will be jerky. 29.97 will be relatively smooth for that section. 59.94 will be perfectly smooth. In order to express different framerates in the same video you would need to make it VFR
I think I fixed it??
Does this look correct?
deint = haf.QTGMC(clip, Preset='slower', TFF=True)[::2]
clip= core.tivtc.TFM(clip, clip2=deint, display=True, order=1, field=-1, mode=0, PP=6,micmatching=3)
clip=core.nnedi3.nnedi3(clip, field=0, dh=True, nsize=4, nns=4, qual=2, etype=0, pscrn=2,exp=2)
clip = core.resize.Lanczos(clip, 720,480)
clip = haf.srestore(clip,frate=23.976)
clip.set_output()
I realized why was I using 2 lines for TFM when I could just combine them.
poisondeathray
3rd November 2021, 15:13
Looks ok. Don't forget to toggle display=False
What was the reason for nnedi3 dh=True and then downscaling?
There is a slight vertical shift when using nnedi3, but the nnedi3_rpow2 function has a cshift parameter that corrects for it
What was the reason for choosing srestore instead of TDecimate ?
There is slight aliasing and degradation on the progressive sides of the wipe border.
Another way you could do it more cleanly is animate a "bar" mask and overlay a QTGMC'ed version corresponding to the bar, onto the IVTC'ed version
Reclusive Eagle
3rd November 2021, 19:23
Looks ok. Don't forget to toggle display=False
What was the reason for nnedi3 dh=True and then downscaling?
There is a slight vertical shift when using nnedi3, but the nnedi3_rpow2 function has a cshift parameter that corrects for it
What was the reason for choosing srestore instead of TDecimate ?
There is slight aliasing and degradation on the progressive sides of the wipe border.
Another way you could do it more cleanly is animate a "bar" mask and overlay a QTGMC'ed version corresponding to the bar, onto the IVTC'ed version
The downscaling is so it fits properly in the vapoursynth Editor Window without fit to screen because that causes massive aliasing -
so its just for me to internally view changes at a smaller scale. Not what the render will be at.
Its basically just comparison testing.
As for sRestore vs decimate. sRestore is just much easier to set up for testing as apposed to the 900 functions of decimate.
Full testing is resized to 1920x1440 and using decimate.
By bar Mask I assume you mean create a line mask and feather it to match the transitions?
I'd happily do that in Photoshop no problem but I have zero Idea how to manipulate masks besides basic functions.
I know you can even create vector shapes in python but again, No idea how to do basic manipulation with code vs GUI and brushes.
I barely have working edge masks with Anime mask and examples from https://blog.kageru.moe/.
So if you could give me any tips or links for manipulating masks in VS that would be highly appreciated.
Either way your solution fixed an issue I've been stuck with for the past week so thank you so much!
poisondeathray
3rd November 2021, 21:28
By bar Mask I assume you mean create a line mask and feather it to match the transitions?
I'd happily do that in Photoshop no problem but I have zero Idea how to manipulate masks besides basic functions.
I know you can even create vector shapes in python but again, No idea how to do basic manipulation with code vs GUI and brushes.
I barely have working edge masks with Anime mask and examples from https://blog.kageru.moe/.
So if you could give me any tips or links for manipulating masks in VS that would be highly appreciated.
Most people would just leave it with TFM clip2 as a decent tradeoff
Some options for procedurally created masks in vapoursynth would be motion masks (MotionMask), or comb masks (CombMask), but it's difficult to tweak them to cover all scenarios and scenes perfectly - compared to a "perfect" animated mask that you make in a NLE or compositing application like After Effects, or natron, or blender, or resolve. Compositing applications like AE are easier to work with in terms of simple mask animation for video than photoshop (although photoshop can work with video directly too)
For the procedurally created masks, often you'll get stray pixels (inclusion/exclusion areas are not perfect), and if you expand the mask, or include more areas, then the benefit diminishes or you start to include areas you don't want. It takes a lot of tweaking to get it close to perfect,and if you get it right for 1 scene, it might not be ok for another scene. And if you spend that much time, you might as well do a proper perfect mask in one of those other programs in the first place. It depends on how much time you want to spend on it
https://github.com/dubhater/vapoursynth-motionmask
https://github.com/chikuzen/CombMask/tree/master/vapoursynth
On Sample1, FG and BG images are static. Only the "wipe" is moving. So a motion mask would be suitable for sample1. But sample2 has expanding circle transitions instead of bar wipe, but the circle overlay translates (it moves x,y) as it's being revealed, instead of being stationary. Sample2 content is actually static too, but the entire shifting image will register as "motion" and that will contaminate a motion mask
But for mask operations, they are similar to in concept to all programs, including photoshop. You can expand or contract masks, you can combine masks, feather masks. AFAIK, the full masktools2 from avisynth has not been ported to vapoursynth yet, just select functions from it
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.