View Full Version : Deinterlacing Video
dolton122
1st August 2018, 17:57
Hii.. So trying to use ExBlend for this video but doesn't seem to be working for it as well as i would've hoped though. not to sure what to do with it or if i can do anything to it...
https://ufile.io/yvjdr
hello_hello
1st August 2018, 20:12
I'm pretty sure it's a field blended NTSC to PAL conversion. To restore it to 23.976fps progressive:
QTGMC()
SRestore()
You could use another bob deinterlacer such as Yadif(Mode=1) instead of QTGMC, but I think QTGMC will do a much better job.
Keep in mind if you jump to a random point in the clip while previewing the script you'll usually see blending until you play the video for a second or two and SRestore has had a chance to find the blending pattern.
http://avisynth.nl/index.php/Srestore
hello_hello
1st August 2018, 20:55
When the blending pattern doesn't change (it's often consistent from start to finish), this simple function can also do the job. It involves a little trial and error in order to manually find the frames to keep, but the following works fairly well for your sample:
function FixBlendPAL(clip Blended, int "Select")
{
Select = default(Select, 2)
Selected = (Select - 1)
assert(1 <= Select <= 10, """ FixBlendPAL: "Select" range is 1 through to 10 """)
Blended
ChangeFPS(24000.0*10.0/1001.0, linear=false)
SelectEvery(10, Selected)
}
QTGMC()
FixBlendPAL(8)
dolton122
2nd August 2018, 16:46
Oh ok thanks hello_hello - so quote script seems to be working but do you add the QTGMC() function in with the the FixBlendPAL because that script itself is giving me the same result
hello_hello
2nd August 2018, 19:20
The function as it is in my previous post requires you to de-interlace before using it. ie
Yadif(mode=1) # or QTGMC()
FixBlendPAL(8)
I do it that way, as the value for "Select" can be any integer from 1 to 10, and sometimes you have to step through the video a bit to find the right one, so I tend to de-interlace with Yadif(mode=1) while trying different values as it's much faster, then replace Yadif with QTGMC for encoding.
If you'd prefer to include the de-interlacing in the function though....
function FixBlendPAL(clip Blended, int "Select")
{
Select = default(Select, 2)
Selected = (Select - 1)
assert(1 <= Select <= 10, """ FixBlendPAL: "Select" range is 1 through to 10 """)
Blended
QTGMC() # or Yadif(mode=1)
ChangeFPS(24000.0*10.0/1001.0, linear=false)
SelectEvery(10, Selected)
}
Don't be afraid to try SRestore for a more automated method. It works well. You can compare them the following way, although if you jump to a random point in the video you'll probably have to let it play for a few seconds before SRestore locks onto the blending pattern again.
Yadif(mode=1)
A = last
B = A.FixBlendPAL(8) # deinterlacing not included in the function
C = A.SRestore()
StackVertical(B, C)
Masaru
4th August 2018, 19:08
QTGMC()
SRestore()
How do I use QTGMC() so that it only deinterlaces the video and doesn't do any further processing (like picture denoising) besides it?
How does SRestore() compare to QTGMC()?
Asmodian
5th August 2018, 07:40
QTGMC(NoiseProcess=0, SMode=0, TR2=0)
SMode=0 to turn off sharpening and TR2=0 to turn off the anti-shimmer temporal linear blur. NoiseProcess defaults to 0 unless you are also using Preset="Very Slow" so QTGMC() has noise process off already. There is also SourceMatch and/or Lossless, which can be nice if using a TR2 > 0, but you should read the docs before you start enabling more features (http://avisynth.nl/index.php/QTGMC).
SRestore() and QTGMC() are not comparable. They do different jobs. hello_hello's suggestion wasn't either or, it was both of them in that order. :)
StainlessS
5th August 2018, 09:03
Asmodian explained perfectly well, but a little extra info,
SRestore requires Progressive, so you deinterlace with QTGMC to turn interlaced into progressive, so that SRestore can do its stuff.
dolton122
5th August 2018, 20:34
Oh also... dealing with another video that has a similar problem that is making it somewhat harder to process so tying to make FixBlendPAL() work but not doing it with that command does it need other filters to make it work?
StainlessS
5th August 2018, 20:55
Use script function from Post #3 (HH was a little bit naughty, not good to hack known function to do something completely different).
Suggest Deinterlace with your favorite filter, Eg QTGMC(... whatever ...)
And In VDub2,
Select Menu/Video/Fast Recompress/
Menu/Video/Compression/UT_Video ("ULY0" if YV12)
Save to an Avi.
Then with your lossless AVI as input, play with Function FixBlend (from post #3) to find best "Select" arg.
When you find best setting, save in VDub2 as before.
manono
6th August 2018, 03:24
Oh also... dealing with another video that has a similar problem that is making it somewhat harder to process so tying to make FixBlendPAL() work but not doing it with that command does it need other filters to make it work?
As before, post an untouched sample, 10 seconds or so with steady movement.
hello_hello
6th August 2018, 09:02
Use script function from Post #3 (HH was a little bit naughty, not good to hack known function to do something completely different).
What did I do??? :confused:
Is there another function with the same name? The function in post #3 was one I created myself after reading this thread:
https://forum.doom9.org/showthread.php?t=97447
I just borrowed scharfis_brain's idea and created a few simple functions to save myself some typing.
# ================================================
# https://forum.doom9.org/showthread.php?t=97447
# For deblending NTSC back to PAL the choices are 1 thru 4.
# For deblending PAL back to NTSC the choices are 1 thru 10.
# ======== PAL-Film Blended Into NTSC 59.94i ================
function FixBlendNTSC(clip Blended, int "Select") {
Select = default(Select, 2)
Selected = Select - 1
assert(1 <= Select <= 4, """ FixBlendNTSC: "Select" value must be 1, 2, 3 or 4 """)
Blended
ChangeFPS(25*4, linear=false)
SelectEvery(4, Selected) }
# ======== NTSC-Film Blended Into PAL 50i ================
function FixBlendPAL(clip Blended, int "Select") {
Select = default(Select, 2)
Selected = Select - 1
assert(1 <= Select <= 10, """ FixBlendPAL: "Select" range is 1 through to 10 """)
Blended
ChangeFPS(24000.0*10.0/1001.0, linear=false)
SelectEvery(10, Selected) }
# ======== NTSC-Progressive (29.97p) Blended Into PAL 50i ================
function FixBlendPAL2(clip Blended, int "Select") {
Select = default(Select, 2)
Selected = Select - 1
assert(1 <= Select <= 10, """ FixBlendPAL2: "Select" range is 1 through to 10 """)
Blended
ChangeFPS(30000.0*10.0/1001.0, linear=false)
SelectEvery(10, Selected) }
# ======== Something Blended Into Something ================
function FixBlendX(clip Blended, int "Select", float "NewRate", int "OverSample") {
Select = default(Select, 2)
Selected = Select - 1
NewRate = default(NewRate, 24.0/1.001)
OverSample = default(OverSample, 10)
assert(1 <= Select <= OverSample, """ FixBlendX: "Select" must be >= 1 & <= "OverSample" """)
assert(FBX_IsReallyFloat(NewRate), """ FixBlendX: "NewRate" must be float (24.0/1.001 or 25.0 etc) """)
Blended
ChangeFPS(NewRate*float(OverSample), linear=false)
SelectEvery(OverSample, Selected) }
# ========
function FBX_IsReallyFloat(val v) {
return !IsInt(v) && IsFloat(v) }
# ================================================
StainlessS
6th August 2018, 11:56
What did I do???
Sorry HH, you are of course entitled to do whatever you wish to your own script function, I thought it was some well known function,
however, in first version you did not deinterlace, and in second you did, so a little bit haphazard, and with no user condition to choose
deinterlace option.
EDIT:
You dont really want 2 versions of the same function (doing considerably different things) making the rounds.
EDIT: It aint no sin to hack a script, but a script Function should not really be hacked on-the-fly, leastwise not in advise
to a user, for yourself, no problem.
Yadif(mode=1)
A = last
B = A.FixBlendPAL(8) # deinterlacing not included in the function
C = A.SRestore()
StackVertical(B, C)
In that post deinterlacing was included [EDIT: within the function], you need to make up your mind which version is current.
hello_hello
6th August 2018, 19:12
Sorry HH, you are of course entitled to do whatever you wish to your own script function, I thought it was some well known function,
however, in first version you did not deinterlace, and in second you did, so a little bit haphazard, and with no user condition to choose deinterlace option.
Here's the "never gonna change it" version. Until I change it again.... :)
Edit: I changed it again. The argument type for the new frame rate (NewRate) for FixBlendX was "float". It should be "val" so the script can do a check to make sure it's correctly specified as float.
# ================================================
/* https://forum.doom9.org/showthread.php?t=97447
https://forum.doom9.org/showthread.php?p=1848202
For deblending NTSC back to PAL the choices are 1 thru 4. FixBlendNTSC(1) or FixBlendNTSC(2) etc.
For deblending PAL back to NTSC 23.976fps the choices are 1 thru 10. FixBlendPAL(3) or FixBlendPAL(5) etc.
For deblending PAL back to NTSC 29.970fps the choices are 1 thru 10. FixBlendPAL2(3) or FixBlendPAL2(5) etc.
For other deblending, FixBlendX can be used to specify the frame to keep, the output frame rate,
and the amount of over-sampling. ie FixBlendX(3, 24.0/1.001, 10)
FixBlendNTSC(), FixBlendPAL(), FixBlendPAL2() & FixBlendX() have no deinterlacing.
Use them after bob de-interlacing first with your preferred de-interlacer,
or after bob deinterlacing with Yadif or QTGMC if you don't want to use their default settings.
yFixBlendNTSC(), yFixBlendPAL(), yFixBlendPAL2() & yFixBlendX() do their own
de-interlacing with Yadif(mode=1). Bob deinterlacing first is not required.
qFixBlendNTSC(), qFixBlendPAL(), qFixBlendPAL2() & qFixBlendX() do their own
de-interlacing with QTGMC(). Bob deinterlacing first is not required. */
# ======== PAL-Film Blended Into NTSC 59.94i ================
function FixBlendNTSC(clip Blended, int "Select") {
Select = default(Select, 2)
Selected = Select - 1
assert(1 <= Select <= 4, """ FixBlendNTSC: "Select" value must be 1, 2, 3 or 4 """)
Blended
ChangeFPS(25*4, linear=false)
SelectEvery(4, Selected) }
# ======== NTSC-Film Blended Into PAL 50i ================
function FixBlendPAL(clip Blended, int "Select") {
Select = default(Select, 2)
Selected = Select - 1
assert(1 <= Select <= 10, """ FixBlendPAL: "Select" range is 1 through to 10 """)
Blended
ChangeFPS(24000.0*10.0/1001.0, linear=false)
SelectEvery(10, Selected) }
# ======== NTSC-Progressive (29.970) Blended Into PAL 50i ================
function FixBlendPAL2(clip Blended, int "Select") {
Select = default(Select, 2)
Selected = Select - 1
assert(1 <= Select <= 10, """ FixBlendPAL2: "Select" range is 1 through to 10 """)
Blended
ChangeFPS(30000.0*10.0/1001.0, linear=false)
SelectEvery(10, Selected) }
# ======== FixBlendX - Something Blended Into Something ================
function FixBlendX(clip Blended, int "Select", val "NewRate", int "OverSample") {
Select = default(Select, 2)
Selected = Select - 1
NewRate = default(NewRate, 24000.0/1001.0)
OverSample = default(OverSample, 10)
assert(1 <= Select <= OverSample, """ FixBlendX: "Select" must be >= 1 & <= "OverSample" """)
assert(FBX_IsReallyFloat(NewRate), """ FixBlendX: "NewRate" must be float (24000.0/1001.0 or 25.0 etc) """)
Blended
ChangeFPS(NewRate*float(OverSample), linear=false)
SelectEvery(OverSample, Selected) }
# ======== Yadif De-interlacing, PAL-Film Blended Into NTSC 59.94i ================
function YFixBlendNTSC(clip Blended, int "Select") {
return FixBlendNTSC(Yadif(Blended, Mode=1), Select) }
# ======== Yadif De-interlacing, NTSC-Film Blended Into PAL 50i ================
function YFixBlendPAL(clip Blended, int "Select") {
return FixBlendPAL(Yadif(Blended, Mode=1), Select) }
# ======== Yadif De-interlacing, NTSC-Progressive (29.970) Blended Into PAL 50i ================
function YFixBlendPAL2(clip Blended, int "Select") {
return FixBlendPAL2(Yadif(Blended, Mode=1), Select) }
# ======== yFixBlendX - Yadif De-interlacing, Something Blended Into Something ================
function YFixBlendX(clip Blended, int "Select", val "NewRate", int "OverSample") {
return FixBlendX(Yadif(Blended, Mode=1), Select, NewRate, OverSample) }
# ======== QTGMC De-interlacing, PAL-Film Blended Into NTSC 59.94i ================
function QFixBlendNTSC(clip Blended, int "Select") {
return FixBlendNTSC(QTGMC(Blended), Select) }
# ======== QTGMC De-interlacing, NTSC-Film Blended Into PAL 50i ================
function QFixBlendPAL(clip Blended, int "Select") {
return FixBlendPAL(QTGMC(Blended), Select) }
# ======== QTGMC De-interlacing, NTSC-Progressive (29.970) Blended Into PAL 50i ================
function QFixBlendPAL2(clip Blended, int "Select") {
return FixBlendPAL2(QTGMC(Blended), Select) }
# ======== qFixBlendX - QTGMC De-interlacing, Something Blended Into Something ================
function QFixBlendX(clip Blended, int "Select", val "NewRate", int "OverSample") {
return FixBlendX(QTGMC(Blended), Select, NewRate, OverSample) }
# ================================================
function FBX_IsReallyFloat(val v) {
return !IsInt(v) && IsFloat(v) }
# ================================================
hello_hello
7th August 2018, 05:03
How do I use QTGMC() so that it only deinterlaces the video and doesn't do any further processing (like picture denoising) besides it?
How does SRestore() compare to QTGMC()?
QTGMC is a de-interlacer. SRestore removes blending. Two different things.
You'd de-interlace, then follow that with the function I posted, if you're happy to check the video and select the frames to keep, or use SRestore instead to remove the blending automatically. It should do a good job.
I think I've deleted your sample, but from memory I'd be letting QTGMC do it's thing because there was a fair bit of shimmering (at least when deinterlacing with Yadif) that QTGMC should fix.
You could try Asmodian's suggestions or enable QTGMC's source match or lossless modes, but your sample could very well look better if you don't. You can only experiment to see what works for you. Read the QTGMC instructions on the wiki or in the html help file if it's still included when you download QTGMC.
I mostly use QTGMC's default settings, but it's personal preference.
dolton122
7th August 2018, 08:40
As before, post an untouched sample, 10 seconds or so with steady movement.
Ok... so doing few other videos but this was the most stand out that is becoming most difficult to do things with - btw mostly using program MeGUI and it does have its own set of deinterlacing filters but doesn't really have one for restoring as such that i can find.
https://ufile.io/29sx1
StainlessS
7th August 2018, 12:30
mostly using program MeGUI
MeGUI is an encoder, and not really suited to experimentation, you really need to have complete script for MeGUI or let it do its stuff automatically, semi automatically.
Where you need find best settings etc, need something else, suggest VirtualDub2:- https://forum.doom9.org/showthread.php?t=172021
It even has an Avsinth Script editor (Tool Menu).
manono
8th August 2018, 05:09
btw mostly using program MeGUI and it does have its own set of deinterlacing filters but doesn't really have one for restoring as such that i can find.
I know nothing about MeGUI I but I assume you can create your own script and open it in MeGUI, or edit the scripts it creates.
Anyway, it's a standard field-blended PAL video. Try this:
Yadif(Mode=1)#or your favorite bobber, like QTGMC
Srestore()
It won't be perfect but that's what happens when you work with garbage.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.