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

Reply
 
Thread Tools Search this Thread Display Modes
Old 17th November 2019, 02:41   #61  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,992
Try this mod to script,

Line 370, Duplicity2.avsi
Code:
    DB=(DBase=="") ? RT_GetFullPathName("~@@@_"+RT_LocalTimeString+".DB") : RT_GetFullPathName(DBase)
Move to 629, just before RT_DBaseAlloc(), add line in red
Code:
        DB=(DBase=="") ? RT_GetFullPathName("~@@@_"+RT_LocalTimeString+".DB") : RT_GetFullPathName(DBase)
RT_DebugF("DBase = '%s'",DB,name="DB_BUGTEST: ")        # Cap in DebugView and post if problem
        RT_DBaseAlloc(DB,FrameCount,"iiiiii")
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 17th November 2019 at 02:59.
StainlessS is offline   Reply With Quote
Old 30th October 2021, 19:56   #62  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,711
I wanted to try DropDeadGorgeous to see if it would work on my test clips. I copy/pasted from posts 46, 47, & 48. When I ran it, I got an error that it needed the DB file and I realized I need to run Duplicity2 first.

I downloaded Duplicity2 and ran it from the client supplied in the zip.

However, I got this error:

Code:
Avisynth open failure
I don't know what ThB means
I looked at your client, and you forgot to provide a default value for this variable, yet you pass it in the function call.

I looked at Duplicity2 and found that the default is simply 2x of another variable so I added this line:
Code:
ThB = ThG*2
That fixed that problem but unfortunately, I then got this error:
Code:
Avisynth open failure:
System exception - Access Violation
Duplicity2.avsi, line 760
Line 760 in that avsi file is this:
Code:
    HasGScript ? GScript(InstS) : Eval(InstS,"GS_EVAL") # Use GSCript if installed (loaded plugs override builtin)
Even though GScript is in my plugins folder, I went ahead and explicity loaded it. I tried both RT_Stats_x86.dll and RT_Stats_25.dll (12/22/2020 versions).

I still get the same error, so I think it is something other than not having RT_Stats installed, or not having the latest version.

I am using AVISynth+ 3.7.0 running under Windows XP Pro 32-bit.
johnmeyer is offline   Reply With Quote
Old 7th November 2021, 21:29   #63  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,992
Hi John, sorry for the delay in response, been a bit otherwise engaged.

Quote:
I don't know what ThB means
from post #25, (in blue [I guess I hid it a bit, sorry])
Code:
Import(".\Duplicity2.Avsi")

######
FN  = "D:\G.AVI"          DBase  = "D:\G_Det.DB"         ThB=2.0
#FN  = "D:\GTEST.AVI"      DBase  = "D:\GTEST_Det.DB"        ThB=2.0
#FN = "D:\HAR.AVI"         DBase  = "D:\HAR_Det.DB"          ThB=2.5
#FN = "D:\DeDupTest.AVI"   DBase  = "D:\DeDupTest_Det.DB"    ThB=2.0
######
Avisource(FN)
SRC=Last
###
Mode=2             # 0=Write Frames only : 1=Replace Dupes with Exact Dupes : 2= Interpolate/Blend Duplicates.
ThG=1.0            # Primary Frame Global Detect
ThP=64             # Pixel Count Detect
MaxDupLen=9        # Max detected, if more then is considered static sequence not duplicate)
MaxInterp=9        # Max Interpolated frames when Mode=2 (More than MaxInterp & less or equal to MaxDupLen then uses Blend mode)
InterpFast=true
Show=True
ShowDot=False
ShowBlk=true
VERB=False
###
TITLE=False
STACK=True
STACK4=False
###

Result=SRC.Duplicity2(Mode=Mode,ThG=ThG,ThB=ThB,ThP=ThP,MaxDupLen=MaxDupLen,MaxInterp=MaxInterp,
    \ Show=False,InterpFast=InterpFast,DBase=(STACK4||!SHOW)?DBase:"")

Metrics=SRC.Duplicity2(Mode=Mode,ThG=ThG,ThB=ThB,ThP=ThP,MaxDupLen=MaxDupLen,MaxInterp=MaxInterp,
    \ Show=True,Verb=VERB,ShowBlk=ShowBlk,ShowDot=ShowDot,InterpFast=InterpFast,DBase=(STACK4||!SHOW)?"":DBase)

Dif=Subtract(Result,SRC)

SRC     = (TITLE) ? SRC.TSub("Src")             : SRC
Result  = (TITLE) ? Result.TSub("Result")       : Result
Metrics = (TITLE) ? Metrics.TSub("Metrics")     : Metrics
Dif     = (TITLE) ? Dif.TSub("Dif(Result,Src)") : Dif

LFT=StackVertical((STACK4||!SHOW)?Result:Metrics,SRC)
RGT=StackVertical(Metrics,Dif)
STK4=StackHorizontal(LFT,RGT)

(STACK4) ? STK4 : (STACK) ? LFT : (Show)?Metrics:Result

Return Last


# Stack Overhead Subtitle Text, with optional FrameNumber shown.
Function TSub(clip c,string Tit,Bool "ShowFrameNo",Int "Col"){
    c.BlankClip(height=20,Color=Default(Col,0))
    (Default(ShowFrameNo,False))?ScriptClip("""Subtitle(String(current_frame,"%.f] """+Tit+""""))"""):Subtitle(Tit)
    Return StackVertical(c).AudioDubEx(c)
}
Quote:
Avisynth open failure:
System exception - Access Violation
Duplicity2.avsi, line 760
I seem to recall a GScript update recent-ish, maybe to smooth out something when using with avs+.
Also, if using AVS+, then GScript not required. [EDIT: remove GScript from plugins and retest with XP version AVS+]
Also, are you using XP version of AVS+ ? [It needs it now, recent test versions of AVS+ do not always contain the XP compat version of AVS+].


EDIT: GScript updated for AVS+ arrays, maybe other mods. [30 Nov 2020].
EDIT: I don't know where I got the 30 Nov 2020 GSCript from, Groucho compiled for x64 May 2020, but that aint it. [EDIT: I think Pinterf maybe did the 30 Nov 2020 ver$]

EDIT: Current AVS+ on XP requires special version because non XP ver$ uses system calls that are non-existing on XP [and so will crash].
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 8th November 2021 at 03:10.
StainlessS is offline   Reply With Quote
Old 8th November 2021, 03:57   #64  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 1,010
Isn't GRunT like replacement for GScript?
VoodooFX is offline   Reply With Quote
Old 8th November 2021, 12:20   #65  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,992
Quote:
Isn't GRunT like replacement for GScript?
Nope.
Gscript = If, For, While, etc [for non + AVS]
Grunt = GScriptClip(Args="...",Local=True/False), + GFrameEvaluate, GConditionalFilter, GWriteFile and GWriteFileIf .
[ with Grunt, ScriptClip(Args="...",Local=True/False) etc also works, the 'G' versions just makes Grunt requirement explicit ]

Grunt:- https://forum.doom9.org/showthread.php?t=139337

Not sure if Avs+ implements as below
Quote:
Originally Posted by Gavino View Post
For added convenience, there is a new variant of ConditionalFilter which takes a single boolean expression instead of three separate parameters as at present. This is useful when the condition to be tested is a compound one or is already available in boolean form. For example,
Code:
ConditionalFilter(c, c1, c2, \
 "AverageLuma(c1) > AverageLuma() && AverageLuma(c1) > AverageLuma(c2)")
where previously you would have to add (...,"=", "true")
EDIT:
Quote:
Originally Posted by StainlessS View Post
P, I note that in runtime filters you added 'local' arg, so is now similar (I presume same) to Grunt, however you did not add 'Args' arg,
that is very handy addition and would still make it necessary for many scripts to use Grunt in Preference.
If Args arg added, would probably make Grunt an un-necessary and superfluous plugin. [Sorry Gavino ]
For a long time a few of us have wanted both GScript & Grunt capability added into Avs source, in avs std the idea was always resisted.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 8th November 2021 at 13:15.
StainlessS is offline   Reply With Quote
Old 8th November 2021, 15:36   #66  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 1,010
Quote:
Originally Posted by StainlessS View Post
Gscript = If, For, While, etc [for non + AVS]
Then why this example below produces "Script error: syntax error"?

Code:
dummy = 1
BlankClip()
if(dummy == 0) {
    crop(2,2,-2,-2)
    } else {
        crop(4,4,-4,-4)
    }

Last edited by VoodooFX; 8th November 2021 at 19:14.
VoodooFX is offline   Reply With Quote
Old 8th November 2021, 17:03   #67  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,367
I think you might need a space between the if and the bracket
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 8th November 2021, 19:16   #68  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 1,010
Quote:
Originally Posted by Dogway View Post
I think you might need a space between the if and the bracket
Didn't helped. Btw, error is at the first curly bracket.
VoodooFX is offline   Reply With Quote
Old 8th November 2021, 19:33   #69  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,367
Ah yep, well it works for me but I use internal conditionals. Might be a Gscript bug.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 8th November 2021, 20:47   #70  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,992
Gcript requires to be wrapped in GScript("..."), eg

Code:
dummy = 1
BlankClip()
GSCript("""
    if(dummy == 0) {
        crop(2,2,-2,-2)
        } else {
            crop(4,4,-4,-4)
        }
""")
Untested.

Or you can import a GScript script use eg GImport("..."), where script itself dont need no GScript("""...""") wrapper.

EDIT: GScript:- https://forum.doom9.org/showthread.p...hlight=GSCript

EDIT: AVS+ implemented GScript language extensions do not require GScript("...") wrappers.
Best avoid loading GScript() plugin when using AVS+. (otherwise if/while etc will require Gscript wrappers, [plugins override builtins] EDIT: Not sure about this, maybe wrong)

EDIT:
Just tried above script, with and without GScript() wrappers, and both worked OK. [avs+ x64 with GScript dll in plugins]
I used to 'belly-ache' about wiki saying something like "avs+ does not need GScript wrappers",
saying that it should read "will not work with Gscript wrapper", so I guess Pinterf got the message and fixed it.
EDIT: Leaving GScript("...") wrapper uncommented, and removing dll from plugins, does produce an error for above script.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 8th November 2021 at 21:17.
StainlessS is offline   Reply With Quote
Old 8th November 2021, 21:06   #71  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 1,010
Quote:
Originally Posted by StainlessS View Post
Best avoid loading GScript() plugin when using AVS+.
Then to hell with that Avs 2.6 support, time to let it rest in peace.
VoodooFX is offline   Reply With Quote
Old 8th November 2021, 21:19   #72  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,992
Quote:
To hell with ...
But see edits.

EDIT:
Best to advise user that v2.60 std using Gscript plugin, then need to load the script using GScript lang extensions using the GImport()
command, and use simple Import() or Plugins autoload avsi, when using AVS+. [AND STRIP ALL INSTANCES of the GScript Wrappers from the actual script containing GScript extensions].
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 8th November 2021 at 21:26.
StainlessS is offline   Reply With Quote
Old 8th November 2021, 21:47   #73  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 1,010
Quote:
Originally Posted by StainlessS View Post
But see edits.
I see.
I renamed InpaintDelogo.avsi to InpaintDelogo.avs, then called it with:
GImport("c:\Program Files (x86)\AviSynth 2.5\plugins\InpaintDelogo.avs")
And looks like it started working with Avs 2.6. [when it comes to run actual if/else code then same error]

EDIT:
Actually it still does't work, it just squashed that error on the script load stage.

EDIT2:
But that "dummy" example works...

EDIT3:
It doesn't work because if/else is inside eval("""..."""), need to get rid of it.

Last edited by VoodooFX; 8th November 2021 at 23:23.
VoodooFX is offline   Reply With Quote
Old 8th November 2021, 23:15   #74  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,992
You can only really load script functions containing GScript extensions, [or whatever code allowed in *.avsi scripts],
in main script, must still wrap any GScript extension code.

Not ideal, but there you go [Gscript("...") and GImport("...") and GEval("...") only affect code that is wrapped in those G thingies]

where Import() is sorta like
Code:
S = RT_ReadTextFromFile(".\SomeScriptFile.avs")
Eval(S)
GImport() is sorta like,
Code:
S = RT_ReadTextFromFile(".\SomeIfElseFile.avs")
GEval(S)
GScript() is sorta like,
Code:
S = "Some If Else stuff"
GEval(S)
You can use eg

Code:
Function FuncNameExists(String Fn)  { Try{Eval(Fn+"()")B=True}catch(e){Assert(e.FindStr("syntax")==0,"FuncNameExists: Error in Function Name '"+Fn+"'")B=(e.FindStr("no function named")==0)}Return B}
Function HasGScript()  { Return FuncNameExists("GSCript") }    # v2.60 std dont have FunctionExist(), so we use above whotsit [which i believe will work ok even in v2.58].

gString =""" Some If Else Stuff"""
(HasGScript) ? GEval(gString) :  ? Eval(gString)
Quote:
Originally Posted by VoodooFX View Post
EDIT3:
It doesn't work because if/else is inside eval("""..."""), need to get rid of it.
looks like you got it.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 8th November 2021 at 23:43.
StainlessS is offline   Reply With Quote
Old 8th November 2021, 23:55   #75  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 1,010
Thanks StainlessS, I think I can make it work with few small edits.

So, your DetSub_Extract.avs can be Avs 2.6 compatible too after all, or not?
VoodooFX is offline   Reply With Quote
Old 19th January 2024, 15:13   #76  |  Link
flossy_cake
Registered User
 
Join Date: Aug 2016
Posts: 715
I'm after something that can blend a duplicate with its neighbours over 4 or 5 frames to hide the jerk.

It seems again you've given me exactly what I want StainlesS, but I need to learn how to use it and my brain isn't working at the moment.

I had previously been trying to achieve it with TDecimate, which can almost do it with its hybrid=3 mode, and you can even specify how many frames to blend the duplicate over with the Cycle=n value.

But it has some kind of bug or intentional behaviour which makes it blend with the wrong frame, eg.

Test video 1080p24 clock: https://drive.google.com/file/d/1jpv...ew?usp=sharing

Code:
# downscale for speedup
Spline36Resize(854, 480) 

# synthesise 1 duplicate frame per second for the first 4 seconds when the clock hand is pointing at 12 (north)
DuplicateFrame(24, 48, 72, 96) 

TDecimate(mode=0,   /* 0 or 1 makes no difference */
\ cycleR=1,  /* must always be 1 */
\ cycle=2,   /* set this to the number of frames you want to blend the dupe over */
\ hybrid=3,
\ viddetect=2,
\ vidthresh=0.9,   /* framediff < 0.9 = dupe */
\ conCycle=1,
\ dupthresh=0.0, 
\ denoise=true,
\ chroma=false,
\ hint=false,
\ display=true)
The first duplicate is done properly, blended with previous (23+24) then blended with next (24-26)



But then the next time the clock hand comes around it blends with 2 frames ahead (51+53 instead of 51+52):



I can increase the Cycle value to 3,4,5 and kind of reduce/delay the issue, but it still eventually does a blend with 2 frames ahead. I think maybe it's following some rule of blending with the next frame with the highest framediff or something, but I don't want that, I just want it to blend with neighbours only. It seems like your filter will do exactly that, just need to figure out how

Last edited by flossy_cake; 20th January 2024 at 06:43.
flossy_cake is offline   Reply With Quote
Old 28th January 2024, 18:04   #77  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,992
Sorry Flossy, I saw this 1 or 2 days ago but had no time. [missed it previously]

Did you get it sorted.
The DropDeadGorgeous thingy is really for situations like webcam cap, where frames may be dropped due to
time constraints and cap driver code speed, and same number of dupes were inserted to make up for it,
so not suitable for your requirement.

Duplicity2, can interpolate/blend a number of consecutive dupes, but using only the two frames from either side of the dupe sequence.

I'm no expert with TDecimate.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 28th January 2024 at 18:06.
StainlessS is offline   Reply With Quote
Old 1st February 2024, 14:57   #78  |  Link
flossy_cake
Registered User
 
Join Date: Aug 2016
Posts: 715
Quote:
Originally Posted by StainlessS View Post

Did you get it sorted.
Yep got it sorted with a slight tweak to TDecimate.cpp in Visual Studio.

For my NTSC DVDs containing cadence breaks I will probably do 2 passes of TDecimate - pass 1 converts the TFM'd 30p to 24p by removing 1 in 5 dupes, then a second pass in hybrid=3 mode to blend over any remaining duplicates which occured due to cadence breaks in the source. I found a cycle value of 5-10 seems to look ok, i.e blend the dupe over 5-10 frames. 2 frames is not enough and still can see the jerk. 5 is kind of okay but still can see a slight jerk. Maybe 7 or 8 could be optimal, still experimenting. The hybrid modes have a useful feature where if it sees one of the frames in the cycle appears to be a scenechange frame, it will not blend it, which is good otherwise you would get blended scenechange frames which look a bit weird visually.

Last edited by flossy_cake; 3rd February 2024 at 09:42.
flossy_cake is offline   Reply With Quote
Reply

Tags
dedup, deduplicate, duplicates

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 01:23.


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