Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 8th December 2018, 11:39   #1  |  Link
Katie Boundary
Registered User
 
Katie Boundary's Avatar
 
Join Date: Jan 2015
Posts: 1,056
Detect and decimate blended frames

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.
__________________
I ask unusual questions but always give proper thanks to those who give correct and useful answers.

Last edited by Katie Boundary; 8th December 2018 at 22:02.
Katie Boundary is offline   Reply With Quote
Old 8th December 2018, 12:01   #2  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
Quote:
Originally Posted by Katie Boundary View Post
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?
Sharc is offline   Reply With Quote
Old 8th December 2018, 18:18   #3  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,695
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.
johnmeyer is offline   Reply With Quote
Old 8th December 2018, 20:07   #4  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
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.p...02#post1848202

Last edited by hello_hello; 8th December 2018 at 20:09.
hello_hello is offline   Reply With Quote
Old 8th December 2018, 22:08   #5  |  Link
Katie Boundary
Registered User
 
Katie Boundary's Avatar
 
Join Date: Jan 2015
Posts: 1,056
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.

Quote:
Originally Posted by Srestore
There is no function named GScriptClip
Yeah, I'm not interested in spending the next week sorting through dependency hell. What's Plan B?
__________________
I ask unusual questions but always give proper thanks to those who give correct and useful answers.
Katie Boundary is offline   Reply With Quote
Old 8th December 2018, 23:22   #6  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,695
Quote:
Originally Posted by Katie Boundary View Post
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.
johnmeyer is offline   Reply With Quote
Old 9th December 2018, 00:12   #7  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,079
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
manolito is offline   Reply With Quote
Old 9th December 2018, 01:07   #8  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
Quote:
Originally Posted by Katie Boundary View Post
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:
Code:
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.
Sharc is offline   Reply With Quote
Old 9th December 2018, 05:41   #9  |  Link
Katie Boundary
Registered User
 
Katie Boundary's Avatar
 
Join Date: Jan 2015
Posts: 1,056
Quote:
Originally Posted by manolito View Post
FWIW here's an older but reliable srestore version 2.7e with all the dependencies included:
https://www.sendspace.com/file/5jdzbh


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
__________________
I ask unusual questions but always give proper thanks to those who give correct and useful answers.
Katie Boundary is offline   Reply With Quote
Old 9th December 2018, 06:38   #10  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,079
Thanks, I really appreciate this...

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
manolito is offline   Reply With Quote
Old 9th December 2018, 07:02   #11  |  Link
Katie Boundary
Registered User
 
Katie Boundary's Avatar
 
Join Date: Jan 2015
Posts: 1,056
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.
__________________
I ask unusual questions but always give proper thanks to those who give correct and useful answers.

Last edited by Katie Boundary; 9th December 2018 at 07:05.
Katie Boundary is offline   Reply With Quote
Old 9th December 2018, 07:15   #12  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,695
I'm just guessing: AIO = All In One ??
johnmeyer is offline   Reply With Quote
Old 9th December 2018, 08:38   #13  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,079
Yes, AIO means "All In One", and this is nothing I invented...
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...%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.

Last edited by manolito; 9th December 2018 at 22:36.
manolito is offline   Reply With Quote
Old 9th December 2018, 12:24   #14  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
Quote:
Originally Posted by Katie Boundary View Post
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.
hello_hello is offline   Reply With Quote
Old 9th December 2018, 19:50   #15  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,496
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.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 22nd December 2018, 10:38   #16  |  Link
Katie Boundary
Registered User
 
Katie Boundary's Avatar
 
Join Date: Jan 2015
Posts: 1,056
Quote:
Originally Posted by manolito View Post
Yes, AIO means "All In One", and this is nothing I invented...
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...%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.
__________________
I ask unusual questions but always give proper thanks to those who give correct and useful answers.
Katie Boundary is offline   Reply With Quote
Old 22nd December 2018, 11:27   #17  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,079
Quote:
Originally Posted by Katie Boundary View Post
IT WORKS TOO!
Thanks...
This is what I always try to achieve: Make it just work.

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:

Quote:
(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
manolito is offline   Reply With Quote
Old 22nd December 2018, 23:55   #18  |  Link
Katie Boundary
Registered User
 
Katie Boundary's Avatar
 
Join Date: Jan 2015
Posts: 1,056
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:

Code:
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
__________________
I ask unusual questions but always give proper thanks to those who give correct and useful answers.
Katie Boundary is offline   Reply With Quote
Old 23rd December 2018, 12:37   #19  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,079
Alright, you made me curious...

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
manolito is offline   Reply With Quote
Old 24th December 2018, 16:58   #20  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
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.

Last edited by hello_hello; 25th December 2018 at 18:59.
hello_hello is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 23:08.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.