View Full Version : Detect and decimate blended frames
Katie Boundary
8th December 2018, 11:39
Is there a filter that can look at a group of X frames (or fields), intelligently mark Y as progressive and Z as blended, and delete the blended ones? I've just learned that seasons 1 and 2 of Beast Wars were not transferred to DVD with quite the same care as the rest of Mainframe's shows.
Sharc
8th December 2018, 12:01
Is there a filter that can look at a group of 5 frames (or fields), intelligently mark 2 as progressive and 3 as blended, and delete the blended ones? I've just learned that seasons 1 and 2 of Beast Wars were not transferred to DVD with quite the same care as the rest of Mainframe's shows.
Is the pattern repetitive or are the 2 progressive and 3 blended frames randomly distributed within the group of 5? Can't you do it with selectevery(5,0,1), assuming frame 0 and 1 are the progressive frames which you want to keep?
johnmeyer
8th December 2018, 18:18
TFM has a huge number of settings to let you do this. Also, if the fields are blended, not the frames, then Srestore is the main tool for dealing with that.
hello_hello
8th December 2018, 20:07
If it's field blending, SRestore would be the first thing to try, but here's a function for doing it "manually".
https://forum.doom9.org/showthread.php?p=1848202#post1848202
Katie Boundary
8th December 2018, 22:08
Because I know you're all going to ask sooner or later, here's what I'm working with: https://www.sendspace.com/file/djpa3q
I'd like to bob-deinterlace that, extract the 25 or 30 "least blended" frames out of every 60, and kill the rest.
There is no function named GScriptClip
Yeah, I'm not interested in spending the next week sorting through dependency hell. What's Plan B?
johnmeyer
8th December 2018, 23:22
I'm not interested in spending the next week sorting through dependency hell. What's Plan B?Since you are posting in an AVISynth forum, one would think you would understand that using this tool involves having to download the appropriate plugins. Since there are now tools that let you get a list of dependencies, so you don't have to guess or work very hard to figure it out, the whole procedure will take you less than five minutes. So, just do it.
manolito
9th December 2018, 00:12
FWIW here's an older but reliable srestore version 2.7e with all the dependencies included:
https://www.sendspace.com/file/5jdzbh
It works with older Operating Systems and older AviSynth versions. Just extract all the files into the "AviSynth\Plugins" folder.
Note: You should not have different versions of MaskTools in the plugins folder. If you already have a newer version (by pinterf which supports high bit depth and all the new and fancy color spaces) you need to rename the file extension of this DLL to something else.
Cheers
manolito
Sharc
9th December 2018, 01:07
Because I know you're all going to ask sooner or later, here's what I'm working with: https://www.sendspace.com/file/djpa3q
I'd like to bob-deinterlace that, extract the 25 or 30 "least blended" frames out of every 60, and kill the rest.
No need to kill the rest. As others have advised:
yadifmod2(mode=1,order=1) #or a bobber of your choice
SRestore(frate=25.000)
restores the clip. No plan B, but worth to make Srestore up and running on your PC.
Katie Boundary
9th December 2018, 05:41
FWIW here's an older but reliable srestore version 2.7e with all the dependencies included:
https://www.sendspace.com/file/5jdzbh
:eek:
It works FLAWLESSLY! Not just in terms of actually working, but also in terms of delivering very clean results. You are my new favorite person :)
manolito
9th December 2018, 06:38
Thanks, I really appreciate this... :D
Being kind of a retro person I like to have my AVSfilters to work on my ancient WinXP machine, even if my main rig now is a Win7-64bit Lenovo notebook. So I do keep a repository of AVS filters with all the dependencies which still work on this old WinXP machine (old Coppermine Celeron 1.1 GHz, no SSE2). I have no use for high bit depth and new colorspaces, so these old filter versions are all I need. QTGMC is another example for this philosophy, let me know if you need such a QTGMC-AIO package...
Cheers
manolito
Katie Boundary
9th December 2018, 07:02
I don't know what "AIO" is but if it means getting QTGMC to work without spending a week pulling my hair out, I'll eagerly try it.
I do all of my music videos, fake trailers, etc. in Premiere Pro 2.0, which doesn't work on versions of Windows newer than XP, so obviously XP compatibility is a huge concern for me.
johnmeyer
9th December 2018, 07:15
I'm just guessing: AIO = All In One ??
manolito
9th December 2018, 08:38
Yes, AIO means "All In One", and this is nothing I invented... :devil:
I got it from the "repacks.net" website which I highly recommend for getting VC++ redistributables.
Anyways, here is the QTGMC AIO package for retro users...
https://files.videohelp.com/u/172211/QTGMC%20for%20Win%20XP%20No-SSE2.zip
Enjoy
manolito
//EDIT//
I forgot to mention that the QTGMC package contains the statically linked versions RemoveGrainS.dll and RepairS.dll. These versions do not need any additional runtimes in the Windows\System32 folder. If you already have the DLL versions without the "S" in your AviSynth\Plugins folder then you should delete them.
hello_hello
9th December 2018, 12:24
It works FLAWLESSLY! Not just in terms of actually working, but also in terms of delivering very clean results.
It seems as though everyone ignoring your signature generally turns out to be a good thing. ;)
wonkey_monkey
9th December 2018, 19:50
One thing to note about srestore is that it takes a few frames to get into its stride - if you're jumping around on the timeline you may see inconsistent results (if you jump to frame x you may not see the same thing as you would if you play through the frame x). It should be completely deterministic when you're encoding though.
It isn't guaranteed flawless, either - it's only extremely good. Deciding with 100% certainty which frames are blended and which aren't is, in general, an intractable problem.
Katie Boundary
22nd December 2018, 10:38
Yes, AIO means "All In One", and this is nothing I invented... :devil:
I got it from the "repacks.net" website which I highly recommend for getting VC++ redistributables.
Anyways, here is the QTGMC AIO package for retro users...
https://files.videohelp.com/u/172211/QTGMC%20for%20Win%20XP%20No-SSE2.zip
IT WORKS TOO!
Now, I'm still not going to "just QTGMC it" for anything that needs to be bob-deinterlaced. It screws up the motion too much in any scenes that aren't 60 hz. However, I will be using it as a drop-in replacement for YADIF/nnedi3 in my custom TFM/Interleave approach to bobbing.
manolito
22nd December 2018, 11:27
IT WORKS TOO!
Thanks...
This is what I always try to achieve: Make it just work. :devil:
I have to admit that I rarely use QTGMC at all, it is just too slow for my old XP machine. A long time ago I asked tritical for params which would give me the most "bang for the buck", i.e. best quality for speed. He recommended this:
(Same rate)
AssumeTFF # or AssumeBFF
yadifmod(edeint=tdeint(mthreshL=0,mthreshC=0))
(Double rate)
AssumeTFF # or AssumeBFF
yadifmod(mode=1, edeint=tdeint(mode=1, mthreshL=0,mthreshC=0))
and I have been using this ever since with very good results. Just my 2 cents...
Cheers
manolito
Katie Boundary
22nd December 2018, 23:55
That's one way to do it but you shouldn't be using a bobber on every pixel of every frame anyway... not after I shared my TFM-TFM-Interleave approach with everyone here. See what kind of speed/performance ratio you can get with this:
A=qtgmc().selecteven()
B=qtgmc().selectodd()
C=Tfm(field=1,mode=0,slow=2,cthresh=2,MI=40,blockx=8,mthresh=2,clip2=A,micmatching=0)
D=Tfm(field=0,mode=0,slow=2,cthresh=2,MI=40,blockx=8,mthresh=2,clip2=B,micmatching=0)
Interleave(C,D)
Cheers :)
manolito
23rd December 2018, 12:37
Alright, you made me curious... :cool:
I cut out a small section of an original Prince clip from a US DVD and converted it with your method, then using the regular method without TFM.
I first tried your method using QTGMC(), but I ended up with a frame rate of less than 0.1 fps. Not really feasible for me, so I replaced "QTGMC()" with "yadifmod(mode=1, edeint=tdeint(mode=1, mthreshL=0,mthreshC=0))" which gave me a frame rate of 6.8 fps.
The regular deinterlace mode using just "yadifmod(mode=1, edeint=tdeint(mode=1, mthreshL=0,mthreshC=0))" without the TFM trick gave me a frame rate of 8.1 fps.
I uploaded the results to SendSpace so anyone interested can compare them:
https://www.sendspace.com/file/pdpq4q
For myself I have to say that I cannot detect any visible difference in quality between the two clips. They both look good to me. And even if using the TFM method did indeed improve quality, wouldn't this be lost after discarding one of the fields in order to achieve the original frame rate for making a DVD?
And another question about the TFM usage:
Aren't you misusing TFM for something it was not intended to? As I understand it TFM was made to match the repeated fields of a clip which result from a telecine operation. But in this case there are no repeated fields. AFAIK a bob deinterlacer does not create repeated fields. So what exactly is TFM doing here? It certainly does something, the two resulting clips are not identical at all. Well, I probably am too "NTSC challenged".
Cheers
manolito
hello_hello
24th December 2018, 16:58
Katie's method (as she posted it), appears to de-interlace the source with QTGMC twice, so it'd potentially be slower rather than faster.
This would only de-interlace once.
A = last
B = A.QTGMC()
C = B.SelectEven()
D = B.SelectOdd()
E = A.TFM(field=1, mode=0, slow=2, cthresh=2, MI=40, blockx=8, mthresh=2, clip2=C, micmatching=0)
F = A.TFM(field=0, mode=0, slow=2, cthresh=2, MI=40, blockx=8, mthresh=2, clip2=D, micmatching=0)
Interleave(E, F)
The above method was about 0.5fps slower than simply using QTGMC() on it's own for my test clip.
For Katie's method, only areas of the frame where TFM detects combing would be replaced with the QTGMC de-interlaced pixels, and frames without combing wouldn't be de-interlaced, although there's probably better ways to achieve that. I guess in a way it attempts to force a pair of fields together instead of interpolating both fields for a pair of frames, but where there's lots of combing, TFM would take the whole frame from QTGMC, so you'd be getting the "bobbed" version anyway.
As a general rule when using QTGMC, I prefer to bob de-interlace every frame because you can end up with quality differences between combed and non-combed frames (sometimes the de-interlaced frames look better or have less noise etc). Not relying on combing detection also ensures no combing is missed, but both methods have their merits, and de-interlacing only where it's needed is possibly better for animation.
The way I understand it, for normal field blending SRestore relies on the fact that only an even or odd field from any given "frame" will be blended, so after bob de-interlacing SRestore can pick out the (new) interpolated frames without any blending. I'm not sure how likely Katie's method would be to mess with SRestore's ability to work. If there's blending in a field and it's forced to match another non-blended field using Katie's method, it'd have to result in "combing" in areas where there's blending, and those areas would be replaced with the corresponding pixels from the QTGMC version, hopefully....
That's probably why she has the combing detection tweaked to make it quite sensitive. The combing where one of the fields has blending is probably harder to detect than "normal" combing.
hello_hello
25th December 2018, 18:58
I played around a little. Here's two comparison videos. YadifMod vs Katie vs TDeint vs QTGMC.
Deinterlacing.zip (https://files.videohelp.com/u/210984/Deinterlacing.zip) (7 MB)
"Bright.mkv" shows where each de-interlacing method replaced pixels by taking them from the version de-interlaced with QTGMC.
"Normal.mkv" is the same again, only without increasing the brightness of the QTGMC clip.
Unless I'm doing something wrong, the Katie method doesn't seem too ideal for interlaced "video".
This was the script. The part highlighted blue was only included for the "Bright.mkv" encodes. The part highlighted green was removed for the second comparison, as that way TFM took less "whole" frames from QTGMC, making it easier to spot the duplicate frames being created.
DGDecode_mpeg2source("D:\NTSC DVD.d2v")
A = last
B = A.QTGMC().Tweak(bright=100)
C = B.Subtitle("QTGMC")
D = A.Yadifmod(mode=1, edeint=B).Subtitle("YadifMod")
E = A.TDeint(mode=1, edeint=B).Subtitle("TDeint")
F = B.SelectEven()
G = B.SelectOdd()
H = A.TFM(field=1, mode=0, clip2=F, cthresh=2, slow=2, MI=40, blockx=8, mthresh=2, micmatching=0)
I = A.TFM(field=0, mode=0, clip2=G, cthresh=2, slow=2, MI=40, blockx=8, mthresh=2, micmatching=0)
J = Interleave(H, I).Subtitle("Katie")
K = StackVertical(D, E)
L = StackVertical(J, C)
StackHorizontal(K, L)
Trim(32290,32390)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.