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 21st June 2020, 01:22   #441  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,377
Thanks it works. The only thing needed in this case was the filename, so just FN_NAME ONLY was sufficient - and I commented out the other parts for the subs/text like frame number , aspect ratio, etc...

Code:
            if(SUBS) {
				FN_NAME_ONLY = RT_FilenameSplit(FN,get=4)    # Name node only, no path, no extension
				k=k.subtitle(FN_NAME_ONLY)
        }
I knew it could be done with RT_Stats, I just had a "feeling" it would be covered . There so much stuff in RT_Stats that I haven't even scratched the surface

Thanks again
poisondeathray is offline   Reply With Quote
Old 21st June 2020, 02:53   #442  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
About to post in Shuffle thread, New ShuffleT(clip c, Int "Seed"=0 , Bool "Inverse"=False ) # Shuffle Temporal, ie shuffle frame order. All valid colorspaces.
__________________
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 ???
StainlessS is offline   Reply With Quote
Old 16th July 2020, 15:58   #443  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
hi StainlessS

I am trying to make function that convert avs trim to trimIn for tfm and still apply the normal trim in the same time, so I come with this

Code:
function intrim(clip i, string "trimline", string "output", string "type") {
Assert(defined(trimline), "'intrim' trimline is needed")
i
lastframe = framecount() - 1
TrimFile=defined(output) ? output : "TrimFile.TXT"
intrimloop(trimline, TrimFile, type, lastframe, true)
eval(trimline)
}

function intrimloop(clip i, string "trimline", string "output", string "type", int "lastframe", bool "firstcall") {
firstcall = default(firstcall, false)
ofindtrim = FindStr(trimline, "trim")
sishtrim = ofindtrim != 0
trimstart = FindStr(trimline, "(")
findtrimstart = trimstart + 1
trimend = FindStr(trimline, ")")
findtrimend = trimend - 1
taketrim = MidStr(trimline, findtrimstart, findtrimend)
trims = FindStr(taketrim, ",")
strim = MidStr(taketrim,1,trims-1).Value.Int
etrim = MidStr(taketrim,trims+1).Value.Int
etrim = etrim == 0 ? lastframe : etrim
ntrimr = rightStr(trimline,StrLen(trimline)-trimend)
ofindntrim = FindStr(ntrimr, "trim")
sishntrim = ofindtrim != 0
ntrimstart = FindStr(ntrimr, "(")
findntrimstart = ntrimstart + 1
ntrims = FindStr(ntrimr, ",")
sntrim = MidStr(ntrimr,1,ntrims-1).Value.Int
istrim = strim !=0 && firstcall ? 0 : etrim + 1
ietrim = firstcall && istrim == 0 ? strim-1 : sishntrim ? sntrim - 1 : lastframe
writeline = !sishntrim ? etrim < lastframe : strim !=0 && sishtrim
writeline ? RT_WriteFile(output, \
                 "%d,%d\n", istrim, ietrim) : nop()
sishntrim ? intrimloop(i, firstcall && istrim == 0 ? trimline : rightStr(trimline,StrLen(trimline)-trimend), output, type, lastframe) : i
}
but with

Code:
ColorBars()
intrim("Trim(2, 198)++Trim(243, 2410)++Trim(20768, 39916)++Trim(42635, 43513)")
it only did
Code:
0,1
it should add more lines or did I missed something?
__________________
See My Avisynth Stuff

Last edited by real.finder; 16th July 2020 at 17:08. Reason: better trim line
real.finder is offline   Reply With Quote
Old 16th July 2020, 17:34   #444  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
RF, can you post exactly what you expect out of it (I aint ever used that intrim with tfm and am falling asleep as I write this).

EDIT: Like this ? [ranges on separate lines]
Code:
0,1
199,242
2411,20767
39917,42634
43514,107891
Last frame number gotten from Framecount of Colorbars
__________________
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; 16th July 2020 at 17:40.
StainlessS is offline   Reply With Quote
Old 16th July 2020, 17:38   #445  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by StainlessS View Post
RF, can you post exactly what you expect out of it (I aint ever used that intrim with tfm and am falling asleep as I write this).
for
Code:
ColorBars()
intrim("Trim(2, 198)++Trim(243, 2410)++Trim(20768, 39916)++Trim(42635, 43513)")
Code:
0,1
199,242
2411,20767
39917,42634
43514,107891
Quote:
Originally Posted by StainlessS View Post
EDIT: Like this ?
Code:
0,1
199,242
2411,20767
39917,42634
43514,107891
Last frame number gotten from Framecount of Colorbars
yes
__________________
See My Avisynth Stuff

Last edited by real.finder; 16th July 2020 at 17:41.
real.finder is offline   Reply With Quote
Old 16th July 2020, 18:17   #446  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Would something like this be preferable ? [ FrameSel:- https://forum.doom9.org/showthread.php?t=167971 ]

Code:
ColorBars().ShowFrameNumber

ofn=".\Outfile.txt"

SCMD="""
    2,198
    243,2410
    20768,39916
    42635,43513
"""

FrameSel_CmdReWrite(Last,ofn,scmd=SCmd,Reject=True,Range=True,Space=False,Prune=False)

Last.FrameSel(scmd=SCMD)
Results in Outfile.txt
Code:
0,1
199,242
2411,20767
39917,42634
43514,107891
EDIT: Framesel does not deal with audio, however can use Prune() via SelectRanges() and RejectRanges():- https://forum.doom9.org/showthread.p...59#post1683559

EDIT: Or like this using Prune
Code:
ColorBars().ShowFrameNumber

outfn  = ".\Outfile.txt"
Prunefn= ".\Prunefile.txt"

SCMD="""
    2,198
    243,2410
    20768,39916
    42635,43513
"""

FrameSel_CmdReWrite(Last,outfn,  scmd=SCmd,Reject=True,Range=True,Space=False,Prune=False)
FrameSel_CmdReWrite(Last,Prunefn,scmd=SCmd,Reject=false,Range=True,Space=False,Prune=true)  # Fixed in Blue

Last.Prune(cmd=Prunefn)
outfile.txt
Code:
0,1
199,242
2411,20767
39917,42634
43514,107891
Prunefile.txt EDIT: Oops was wrong as for fix BLUE above
Code:
0,2,198
0,243,2410
0,20768,39916
0,42635,43513
__________________
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; 16th July 2020 at 19:10.
StainlessS is offline   Reply With Quote
Old 16th July 2020, 18:22   #447  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by StainlessS View Post
Would something like this be preferable ? [ FrameSel:- https://forum.doom9.org/showthread.php?t=167971 ]

Code:
ColorBars().ShowFrameNumber

ofn=".\Outfile.txt"

SCMD="""
    2,198
    243,2410
    20768,39916
    42635,43513
"""

FrameSel_CmdReWrite(Last,ofn,scmd=SCmd,Reject=True,Range=True,Space=False,Prune=False)

Last.FrameSel(scmd=SCMD)
Results in Outfile.txt
Code:
0,1
199,242
2411,20767
39917,42634
43514,107891
I will try it then
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 16th July 2020, 18:37   #448  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
The SelectRanges() version [but does pretty much same as the Prune version in prev post script]
Code:
ColorBars().ShowFrameNumber

outfn  = ".\Outfile.txt"

SCMD="""
    2,198
    243,2410
    20768,39916
    42635,43513
"""

FrameSel_CmdReWrite(Last,outfn,  scmd=SCmd,Reject=True,Range=True,Space=False,Prune=False) # Trim excluded

SelectRanges(scmd=SCMD)     # Trim Included (SelectRanges Script in FrameSel AVS dir (also requires Prune if audio))
EDIT: Also NOTE, in your original script, RT_WriteFile would require "Append=true" to work properley [when bugs fixed].

EDIT: Maybe best like this
Code:
ColorBars().ShowFrameNumber

outfn  = ".\Outfile.txt"

PruneTMP=RT_GetSystemEnv("TEMP") + "\~PruneTMP_" + RT_LocalTimeString(file=True) + ".TMP"      # Unique name in User TEMP directory

SCMD="""
    2,198
    243,2410
    20768,39916
    42635,43513
"""

FrameSel_CmdReWrite(Last,outfn,   scmd=SCmd,Reject=True,Range=True,Space=False,Prune=False)     # Trim Excluded ranges
FrameSel_CmdReWrite(Last,PruneTMP,scmd=SCmd,Reject=False,Range=True,Space=False,Prune=true)     # Trim Included ranges in Prune Format # Fixed in Blue

Prune(cmd=PruneTMP)                                                                             # Trim

RT_FileDelete(PruneTMP)                                                                         # Del temp prune command file

Return Last
and again result outfile of trim excluded ranges
Code:
0,1
199,242
2411,20767
39917,42634
43514,107891
__________________
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; 16th July 2020 at 19:02.
StainlessS is offline   Reply With Quote
Old 16th July 2020, 19:37   #449  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by StainlessS View Post
EDIT: Also NOTE, in your original script, RT_WriteFile would require "Append=true" to work properley [when bugs fixed].
thanks, it's work now

Code:
function intrim(clip i, string "trimline", string "output", string "type") {
Assert(defined(trimline), "'intrim' trimline is needed")
i
lastframe = framecount() - 1
TrimFile=defined(output) ? output : "TrimFile.TXT"
intrimloop(LCase(trimline), TrimFile, type, lastframe, true)
eval(trimline)
}

function intrimloop(clip i, string "trimline", string "output", string "type", int "lastframe", bool "firstcall") {
firstcall = default(firstcall, false)
ofindtrim = FindStr(trimline, "trim")
sishtrim = ofindtrim != 0
trimstart = FindStr(trimline, "(")
findtrimstart = trimstart + 1
trimend = FindStr(trimline, ")")
findtrimend = trimend - 1
taketrim = MidStr(trimline, findtrimstart, findtrimend)
trims = FindStr(taketrim, ",")
strim = MidStr(taketrim,1,trims-1).Value.Int
etrim = MidStr(taketrim,trims+1).Value.Int
etrim = etrim == 0 ? lastframe : etrim
ntrimr = rightStr(trimline,StrLen(trimline)-trimend)
ofindntrim = FindStr(ntrimr, "trim")
sishntrim = ofindntrim != 0
ntrimstart = sishntrim ? FindStr(ntrimr, "(") : nop()
findntrimstart = !sishntrim ? nop() : ntrimstart + 1
ntrims = !sishntrim ? nop() : FindStr(ntrimr, ",")
sntrim = !sishntrim ? nop() : MidStr(ntrimr,findntrimstart,ntrims-1).Value.Int
istrim = strim !=0 && firstcall ? 0 : etrim + 1
ietrim = firstcall && istrim == 0 ? strim-1 : sishntrim ? sntrim - 1 : lastframe
writeline = sishtrim ? sishntrim ? strim != 0 : etrim < lastframe : false
writeline ? RT_WriteFile(output, \
                 "%d,%d\n", istrim, ietrim, append=true) : nop()
sishntrim ? intrimloop(i, firstcall && istrim == 0 ? trimline : rightStr(trimline,StrLen(trimline)-trimend), output, type, lastframe) : i
}
now I need to make it better, and made another function to abridgement trims line like this trim(2, 198)++trim(199, 242)++trim(243, 2410)++Trim(2411, 20767)++Trim(20768, 39916)++Trim(39917, 42634)++Trim(42635, 43513) to trim(2, 43513)
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 16th July 2020, 23:40   #450  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
now I need to make it better, and made another function to abridgement
Abridgement.avs
Code:
ColorBars().ShowFrameNumber

SCMD="""
    2,198
    199,242
    243, 2410
    2411, 20767
    20768, 39916
    39917, 42634
    42635, 43513
"""

outFn    = ".\Abridgement.txt"

FrameSel_CmdReWrite(Last,Outfn, scmd=SCmd, Reject=False,Ordered=True,Range=True,Space=False,Prune=False)

Return Last
Abridgement.txt
Code:
2,43513
EDIT: Or this (Same output result)
Code:
ColorBars().ShowFrameNumber

INCMD="""
    2,198
    243, 2410
    20768, 39916
    42635, 43513
"""

OUTCMD="""
    199,242
    2411, 20767
    39917, 42634
"""

SCMD = INCMD + OUTCMD

outFn    = ".\Abridgement.txt"

FrameSel_CmdReWrite(Last,Outfn, scmd=SCmd, Reject=False,Ordered=True,Range=True,Space=False,Prune=False)

Return Last
Above, Orders and coalesces all the ranges, outputting only distinct ranges, in above case only a single output range.

EDIT: What is the end result of all of this, give complete description of ALL required [and take your time ].
EDIT: Also, what about audio ?
__________________
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 July 2020 at 00:48.
StainlessS is offline   Reply With Quote
Old 17th July 2020, 00:40   #451  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by StainlessS View Post
Abridgement.avs
Code:
ColorBars().ShowFrameNumber

SCMD="""
    2,198
    199,242
    243, 2410
    2411, 20767
    20768, 39916
    39917, 42634
    42635, 43513
"""

outFn    = ".\Abridgement.txt"

FrameSel_CmdReWrite(Last,Outfn, scmd=SCmd, Reject=False,Ordered=True,Range=True,Space=False,Prune=False)

Return Last
Abridgement.txt
Code:
2,43513
EDIT: Or this (Same output result)
Code:
ColorBars().ShowFrameNumber

INCMD="""
    2,198
    243, 2410
    20768, 39916
    42635, 43513
"""

OUTCMD="""
    199,242
    2411, 20767
    39917, 42634
"""

SCMD = INCMD + OUTCMD

outFn    = ".\Abridgement.txt"

FrameSel_CmdReWrite(Last,Outfn, scmd=SCmd, Reject=False,Ordered=True,Range=True,Space=False,Prune=False)

Return Last
Above, Orders and coalesces all the ranges, outputting only distinct ranges, in above case only a single output range.

EDIT: What is the end result of all of this, give complete description of ALL required [and take your time ].
thanks, I was working on this too

Code:
function abtrim(string "trimline") {
Assert(defined(trimline), "'intrim' trimline is needed")
abtrimloop(LCase(trimline))
}

function abtrimloop(string "trimline", int "remainder") {
remainder = default(remainder, -1)
otrimline = trimline
trimline = remainder > 0 ? RightStr(trimline, remainder) : trimline
ofindtrim = FindStr(trimline, "trim")
sishtrim = ofindtrim != 0
trimstart = FindStr(trimline, "(")
findtrimstart = trimstart + 1
trimend = FindStr(trimline, ")")
findtrimend = trimend - 1
taketrim = MidStr(trimline, findtrimstart, findtrimend)
trims = FindStr(taketrim, ",")
strim = !sishtrim ? nop() : MidStr(taketrim,1,trims-1).Value.Int
etrim = !sishtrim ? nop() : MidStr(taketrim,trims+1).Value.Int
ntrimr = RightStr(trimline,StrLen(trimline)-trimend)
ofindntrim = FindStr(ntrimr, "trim")
sishntrim = ofindntrim != 0
ntrimstart = sishntrim ? FindStr(ntrimr, "(") : nop()
findntrimstart = !sishntrim ? nop() : ntrimstart + 1
ntrims = !sishntrim ? nop() : FindStr(ntrimr, ",")
sntrim = !sishntrim ? nop() : MidStr(ntrimr,findntrimstart,ntrims-1).Value.Int
ntrimline=LeftStr(otrimline,trims+findtrimstart+(remainder > 0 ? remainder : 0))+(((etrim+1)==sntrim) ? MidStr(ntrimr,ntrims+1) : MidStr(trimline,trims+findtrimstart+1))
pointer = !sishtrim ? 0 : remainder != 0 ? remainder == -1 ? ntrimline != otrimline ? FindStr(ntrimline, "+") != 0 ? trims+findtrimstart-1 : 0 : FindStr(ntrimline, "+") : remainder + FindStr(RightStr(ntrimline, StrLen(ntrimline) - remainder), "+") : nop()
pointer != 0 ? abtrimloop(ntrimline, pointer) : ntrimline
}
it work with abtrim("trim(2, 198)++trim(199, 242)++trim(243, 2410)++Trim(2411, 20767)++Trim(20768, 39916)++Trim(39917, 42634)++Trim(42635, 43513)")

but still not for this (need fix, still working on it) abtrim("trim(2, 198)++trim(243, 2410)++Trim(2411, 20767)++Trim(20768, 39916)++Trim(39917, 42634)++Trim(42635, 43513)")

and it need nothing but avs
__________________
See My Avisynth Stuff

Last edited by real.finder; 17th July 2020 at 10:51.
real.finder is offline   Reply With Quote
Old 17th July 2020, 01:02   #452  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
I'll look again at all of this tomorrow.
Would be a lot easier (I think) if had frames list source (String or file), and processed that, instead of screwing around trying to parse
list with "Trim(xxx, yyy) ++ ..." etc, much easier to create trim command from frames string/file than
to parse trims command and extract frames list from that.

Also, making it all work in Avs script alone [and properley] is not gonna be easy, nor small.
EDIT: Although with recent AVS+ arrays at least can implement frame range sorting and coalescing with less difficulty.
(I'm not using array supporting versions of Avs+, it dont work with XP MeGUI, so I'm pretty much sticking with avs+ 3.5, r3106)

EDIT:
Quote:
and it need nothing but avs
Is RT_ usage OK ? [you use it for RT_writeFile() ].
For your abridgement thing, you need to parse and verify correctness of your frame ranges, eg end frame same or after start frame,
for coalescing, you also need sorting all ranges beforehand. If you dont do it properley, it will bite your ass the first time
somebody screws up the trims/ranges list.
Without proper parsing/sorting/checking, will run risk of eg Infinite Recursion, stack exhaustion, where script/avisynth will just disappear
without any error message or indication of what went wrong, not a good way to crash, or, it might just badly mangle your result clip.
The things you are attempting are quite tricky even in C, in basic script is gonna be less easy.

EDIT: Also, before you use RT_WriteFile with Append=true, is best to use RT_FileDelete on the target file [in the intrim() func].
Otherwise on multiple use eg
Code:
0,1
199,242
2411,20767
39917,42634
43514,107891
0,1
199,242
2411,20767
39917,42634
43514,107891
...
etc
__________________
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 July 2020 at 09:40.
StainlessS is offline   Reply With Quote
Old 17th July 2020, 10:46   #453  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Is RT_ usage OK ? [you use it for RT_writeFile() ].
yes, in fact abtrim is for helping intrim

Quote:
EDIT: Also, before you use RT_WriteFile with Append=true, is best to use RT_FileDelete on the target file [in the intrim() func].
yes, I note this, will use it when I done with abtrim

edit: I think this did it!

Code:
function abtrim(string "trimline") {
Assert(defined(trimline), "'intrim' trimline is needed")
abtrimloop(LCase(trimline))
}

function abtrimloop(string "trimline", int "remainder") {
remainder = default(remainder, -1)
otrimline = trimline
sisending = !(remainder < StrLen(trimline))
trimline = remainder > 0 ? !sisending ? RightStr(trimline, StrLen(trimline) - remainder) : trimline : trimline
ofindtrim = sisending ? nop() : FindStr(trimline, "trim")
sishtrim = sisending ? false : ofindtrim != 0
trimstart = !sishtrim ? nop() : ofindtrim + FindStr(MidStr(trimline, ofindtrim + 1), "(")
findtrimstart = !sishtrim ? nop() : trimstart + 1
trimend = !sishtrim ? nop() : ofindtrim + FindStr(MidStr(trimline, ofindtrim + 1), ")")
findtrimend = !sishtrim ? nop() : trimend - 1
taketrim = !sishtrim ? nop() : MidStr(trimline, findtrimstart, findtrimend - findtrimstart + 1)
trims = !sishtrim ? nop() : FindStr(taketrim, ",")
strim = !sishtrim ? nop() : MidStr(taketrim,1,trims-1).Value.Int
etrim = !sishtrim ? nop() : MidStr(taketrim,trims+1).Value.Int
ntrimr = !sishtrim ? nop() : RightStr(trimline,StrLen(trimline)-trimend)
ofindntrim = !sishtrim ? nop() : FindStr(ntrimr, "trim")
sishntrim = !sishtrim ? nop() : ofindntrim != 0
ntrimstart = !sishtrim ? nop() : sishntrim ? FindStr(ntrimr, "(") : nop()
findntrimstart = !sishtrim ? nop() : !sishntrim ? nop() : ntrimstart + 1
ntrims = !sishtrim ? nop() : !sishntrim ? nop() : FindStr(ntrimr, ",")
sntrim = !sishtrim ? nop() : !sishntrim ? nop() : MidStr(ntrimr,findntrimstart,ntrims-1).Value.Int
domerge = !sishtrim ? nop() : sishntrim ? ((etrim+1)==sntrim) : false
ntrimline=!sishtrim ? nop() : !domerge ? otrimline : LeftStr(otrimline,(remainder > 0 ? remainder : 0) + findtrimstart + trims - 1) + MidStr(ntrimr,ntrims+1)
remainder = !sishtrim ? nop() : domerge ? remainder : max(0,remainder) + trimend
!sishtrim ? otrimline : sishntrim ? abtrimloop(ntrimline, remainder) : ntrimline
}
edit: even better for both

Code:
function abtrim(string "trimline") {
Assert(defined(trimline), "'intrim' trimline is needed")
function abtrimloop(string "trimline", int "remainder") {
remainder = default(remainder, -1)
otrimline = trimline
sisending = !(remainder < StrLen(trimline))
trimline = remainder > 0 ? !sisending ? RightStr(trimline, StrLen(trimline) - remainder) : trimline : trimline
ofindtrim = sisending ? nop() : FindStr(trimline, "trim")
sishtrim = sisending ? false : ofindtrim != 0
trimstart = !sishtrim ? nop() : ofindtrim + FindStr(MidStr(trimline, ofindtrim + 1), "(")
findtrimstart = !sishtrim ? nop() : trimstart + 1
trimend = !sishtrim ? nop() : ofindtrim + FindStr(MidStr(trimline, ofindtrim + 1), ")")
findtrimend = !sishtrim ? nop() : trimend - 1
taketrim = !sishtrim ? nop() : MidStr(trimline, findtrimstart, findtrimend - findtrimstart + 1)
trims = !sishtrim ? nop() : FindStr(taketrim, ",")
strim = !sishtrim ? nop() : MidStr(taketrim,1,trims-1).Value.Int
etrim = !sishtrim ? nop() : MidStr(taketrim,trims+1).Value.Int
ntrimr = !sishtrim ? nop() : RightStr(trimline,StrLen(trimline)-trimend)
ofindntrim = !sishtrim ? nop() : FindStr(ntrimr, "trim")
sishntrim = !sishtrim ? nop() : ofindntrim != 0
ntrimstart = !sishtrim ? nop() : sishntrim ? FindStr(ntrimr, "(") : nop()
findntrimstart = !sishtrim ? nop() : !sishntrim ? nop() : ntrimstart + 1
ntrims = !sishtrim ? nop() : !sishntrim ? nop() : FindStr(ntrimr, ",")
sntrim = !sishtrim ? nop() : !sishntrim ? nop() : MidStr(ntrimr,findntrimstart,ntrims-1).Value.Int
domerge = !sishtrim ? nop() : sishntrim ? ((etrim+1)==sntrim) : false
ntrimline=!sishtrim ? nop() : !domerge ? otrimline : LeftStr(otrimline,(remainder > 0 ? remainder : 0) + findtrimstart + trims - 1) + MidStr(ntrimr,ntrims+1)
remainder = !sishtrim ? nop() : domerge ? remainder : max(0,remainder) + trimend
!sishtrim ? otrimline : sishntrim ? abtrimloop(ntrimline, remainder) : ntrimline
}
abtrimloop(LCase(trimline))
}

function intrim(clip i, string "trimline", string "output") {
Assert(defined(trimline), "'intrim' trimline is needed")
i
lastframe = framecount() - 1
TrimFile=defined(output) ? output : "TrimFile.TXT"
Exist(TrimFile) ? RT_FileDelete(TrimFile) : nop()
function intrimloop(clip i, string "trimline", string "output", int "lastframe", bool "firstcall") {
firstcall = default(firstcall, false)
ofindtrim = FindStr(trimline, "trim")
sishtrim = ofindtrim != 0
trimstart = !sishtrim ? nop() : FindStr(trimline, "(")
findtrimstart = !sishtrim ? nop() : trimstart + 1
trimend = !sishtrim ? nop() : FindStr(trimline, ")")
findtrimend = !sishtrim ? nop() : trimend - 1
taketrim = !sishtrim ? nop() : MidStr(trimline, findtrimstart, findtrimend-findtrimstart+1)
trims = !sishtrim ? nop() : FindStr(taketrim, ",")
strim = !sishtrim ? nop() : MidStr(taketrim,1,trims-1).Value.Int
etrim = !sishtrim ? nop() : MidStr(taketrim,trims+1).Value.Int
etrim = !sishtrim ? nop() : etrim == 0 ? lastframe : etrim
ntrimr = !sishtrim ? nop() : rightStr(trimline,StrLen(trimline)-trimend)
ofindntrim = !sishtrim ? nop() : FindStr(ntrimr, "trim")
sishntrim = !sishtrim ? nop() : ofindntrim != 0
ntrimstart = !sishtrim ? nop() : sishntrim ? FindStr(ntrimr, "(") : nop()
findntrimstart = !sishtrim ? nop() : !sishntrim ? nop() : ntrimstart + 1
ntrims = !sishtrim ? nop() : !sishntrim ? nop() : FindStr(ntrimr, ",")
sntrim = !sishtrim ? nop() : !sishntrim ? nop() : MidStr(ntrimr,findntrimstart,ntrims-1).Value.Int
istrim = !sishtrim ? nop() : !sishtrim ? nop() : strim !=0 && firstcall ? 0 : etrim + 1
ietrim = !sishtrim ? nop() : !sishtrim ? nop() : firstcall && istrim == 0 ? strim-1 : sishntrim ? sntrim - 1 : lastframe
writeline = sishtrim ? sishntrim ? strim != 0 : etrim < lastframe : false
writeline ? RT_WriteFile(output, \
                 "%d,%d\n", istrim, ietrim, append=true) : nop()
sishtrim ? intrimloop(i, firstcall && istrim == 0 ? trimline : rightStr(trimline,StrLen(trimline)-trimend), output, lastframe) : i
}
intrimloop(abtrim(trimline), TrimFile, lastframe, true)
eval(trimline)
}
I think it's ok, unless there are hidden bug, for now only RT_Stats is needed for intrim

edit: I added them in https://github.com/realfinder/AVS-St...AnimeIVTC.avsi

if there any update in future it will be there
__________________
See My Avisynth Stuff

Last edited by real.finder; 17th July 2020 at 21:53.
real.finder is offline   Reply With Quote
Old 15th December 2020, 00:09   #454  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by StainlessS View Post
Nope cant be done unless arrays implemented in script.
[No idea if arrays version of 3.6 would work, I have been sticking to 3.52 noarray version].
Assuming that arrays as args to script functions do work, then try to just pass the array to the dll. [see what happens]

EDIT: Actually I'm using 3.5 r3106.
avs+ 3.6 and array work, I did it in UniversalPluginsFolders recently (in plugins64+ folder)
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 15th December 2020, 18:24   #455  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
I really should not be spending any time on D9, too busy.
But, when I do get time, I'll dissect UniversalPluginsFolders and steal all of the good bits.
__________________
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 ???
StainlessS is offline   Reply With Quote
Old 29th December 2020, 19:00   #456  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
RT_Stats 2.0 Beta 13, Update:- https://www.mediafire.com/file/xa3t1...01229.zip/file
Also on SendSpace below this post.
__________________
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 ???
StainlessS is offline   Reply With Quote
Old 30th March 2021, 08:40   #457  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
lets say that there are comments (with #) like this:-

Code:
#~ Trim(0, 9006)++Trim(9007, 23602)++Trim(23603, 40776)++Trim(40777, 43472)++Trim(43473, 44402)
Trim(44403, 48808)++Trim(48809, 64002)++Trim(64003, 85162)++Trim(85163, 87858)++Trim(87859, 88788)
#~ ++Trim(88789, 94064)++Trim(94065, 108480)++Trim(108481, 129550)++Trim(129551, 132246)++Trim(132247, 133356)
is there a way to delete comment lines from string? so it will be as

Code:
Trim(44403, 48808)++Trim(48809, 64002)++Trim(64003, 85162)++Trim(85163, 87858)++Trim(87859, 88788)
need this since those lines will break inTrim()
__________________
See My Avisynth Stuff

Last edited by real.finder; 30th March 2021 at 08:53.
real.finder is offline   Reply With Quote
Old 30th March 2021, 16:11   #458  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Does this sort you out OK R.F., ?

(I've left in non required Chr testing funcs)

Code:
Function ChrIsNul(String S)      {return RT_Ord(S)== 0}                             # End of String
Function ChrIsTAB(String S)      {return RT_Ord(S)== 9}                             # TAB
Function ChrIsLF(String S)       {return RT_Ord(S)==10}                             # Line Feed (New Line)
Function ChrIsCR(String S)       {return RT_Ord(S)==13}                             # Carriage Return
Function ChrIsSPACE(String S)    {return RT_Ord(S)==32}                             # SPACE
Function ChrIsBang(String S)     {return RT_Ord(S)==33}                             # !
Function ChrIsDQuote(String S)   {return RT_Ord(S)==34}                             # "
Function ChrIsHash(String S)     {return RT_Ord(S)==35}                             # #
Function ChrIsDollar(String S)   {return RT_Ord(S)==36}                             # $
Function ChrIsPercent(String S)  {return RT_Ord(S)==37}                             # %
Function ChrIsAmp(String S)      {return RT_Ord(S)==38}                             # &
Function ChrIsSQuote(String S)   {return RT_Ord(S)==39}                             # '
Function ChrIsOParen(String S)   {return RT_Ord(S)==40}                             # (
Function ChrIsCParen(String S)   {return RT_Ord(S)==41}                             # )
Function ChrIsStar(String S)     {return RT_Ord(S)==42}                             # *
Function ChrIsPlus(String S)     {return RT_Ord(S)==43}                             # +
Function ChrIsComma(String S)    {return RT_Ord(S)==44}                             # ,
Function ChrIsHyphen(String S)   {return RT_Ord(S)==45}                             # -
Function ChrIsDot(String S)      {return RT_Ord(S)==46}                             # .
Function ChrIsSlash(String S)    {return RT_Ord(S)==47}                             # /
Function ChrIsColon(String S)    {return RT_Ord(S)==58}                             # :
Function ChrIsSColon(String S)   {return RT_Ord(S)==59}                             # ;
Function ChrIsLT(String S)       {return RT_Ord(S)==60}                             # <
Function ChrIsEqual(String S)    {return RT_Ord(S)==61}                             # =
Function ChrIsGT(String S)       {return RT_Ord(S)==62}                             # >
Function ChrIsQuery(String S)    {return RT_Ord(S)==63}                             # ?
Function ChrIsAt(String S)       {return RT_Ord(S)==64}                             # @
Function ChrIsOSquare(String S)  {return RT_Ord(S)==91}                             # [
Function ChrIsBSlash(String S)   {return RT_Ord(S)==92}                             # /
Function ChrIsCSquare(String S)  {return RT_Ord(S)==93}                             # ]
Function ChrIsHat(String S)      {return RT_Ord(S)==94}                             # ^
Function ChrIsUScore(String S)   {return RT_Ord(S)==95}                             # _
Function ChrIsOCurly(String S)   {return RT_Ord(S)==123}                            # {
Function ChrIsPipe(String S)     {return RT_Ord(S)==124}                            # |
Function ChrIsCCurly(String S)   {return RT_Ord(S)==125}                            # }
Function ChrIsTilde(String S)    {return RT_Ord(S)==126}                            # ~
#
Function ChrIsWhite(String S)    {C=RT_Ord(S) return C==32||C>=8&&C<=13}            # SPC, BackSPC, TAB, LF, VT, FF, CR
Function ChrIsDigit(String S)    {C=RT_Ord(S) return C>=48&&C<=57}
Function ChrIsUCase(String S)    {C=RT_Ord(S) return C>=65&&C<=90}
Function ChrIsLCase(String S)    {C=RT_Ord(S) return C>=97&&C<=122}
Function ChrIsAlpha(String S)    {C=RT_Ord(S) return C>=65&&C<=90||C>=97&&C<=122}
Function ChrIsHex(String S)      {C=RT_Ord(S) return C>=48&&C<=57||C>=65&&C<=70||C>=97&&C<=102}
# Req GScript or AVS+
Function ChrEatWhite(String S)   {i=1 C=RT_Ord(S,i) While(C==32||C>=8&&C<=13)                        {i=i+1 C=RT_Ord(S,i)} return i>1?MidStr(S,i):S}
Function ChrEatAlpha(String S)   {i=1 C=RT_Ord(S,i) While(C>=65&&C<=90||C>=97&&C<=122)               {i=i+1 C=RT_Ord(S,i)} return i>1?MidStr(S,i):S}
Function ChrEatDigits(String S)  {i=1 C=RT_Ord(S,i) While(C>=48&&C<=57)                              {i=i+1 C=RT_Ord(S,i)} return i>1?MidStr(S,i):S}
Function ChrEatHex(String S)     {i=1 C=RT_Ord(S,i) While(C>=48&&C<=57||C>=65&&C<=70||C>=97&&C<=102) {i=i+1 C=RT_Ord(S,i)} return i>1?MidStr(S,i):S}

#################################### Above, we only use ChrEatWhite

SSS="""
#~ Trim(0, 9006)++Trim(9007, 23602)++Trim(23603, 40776)++Trim(40777, 43472)++Trim(43473, 44402)
Trim(44403, 48808)++Trim(48809, 64002)++Trim(64003, 85162)++Trim(85163, 87858)++Trim(87859, 88788)
#~ ++Trim(88789, 94064)++Trim(94065, 108480)++Trim(108481, 129550)++Trim(129551, 132246)++Trim(132247, 133356)
"""

NewS = ""
LineCount = SSS.RT_TxtQueryLines
for(i=0,LineCount-1) {  # Will Ignore Blank lines and lines where first non-white char is hash '#'.
    TmpS = SSS.RT_TxtGetLine(i).ChrEatWhite   # Get line of text from multi-line string and remove leading whitespace.
    if(TmpS.RT_Ord != 35 && TmpS.RT_Ord != 0) {     # NOT '#' or End Of Line
        NewS = (NewS=="") ? TmpS : NewS + Chr(10) + TmpS
    }
}

BlankClip(Width=1024,height=640,length=1).RT_Subtitle("Stripped =\n%s",NewS)
__________________
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 ???
StainlessS is offline   Reply With Quote
Old 30th March 2021, 16:41   #459  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
yes, thanks StainlessS

__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 4th April 2021, 20:57   #460  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,361
StainlessS is RT_QwikScan() aimed to align matching shots or only frames (ala MatchFrames). I spend a lot of time syncing videos (to match audio actually) and I grew tired of it, some shots are longer, shorter, slided, added or omitted, as such an example manually crafted script would look like this:

Code:
v=ffvideosource("E:\video01.mkv")
a=LWLibavaudioSource("E:\video01.mkv")

v2=ffvideosource("E:\video02.mkv")
a2=LWLibavaudioSource("E:\video02.mkv").ConvertAudioToFloat()

a.ConvertAudioToFloat()

audiodub(v,last)
assumefps(24000,1001)

av2=audiodub(v2,a2)

TimeStretch(rate=((24000.0/1001.0)*100.0)/25.0)

trim(746,0)
trim(0,28046)+trim(av2,28046+1,28502)+trim(28202+1,0)
trim(0,30886)+trim(av2,30886+1,30886+14*24+4)+trim(30886+1,0)
trim(0,37583)+trim(av2,37583+1,37583+13*24+3)+trim(37583+1,0)
trim(0,39334)+trim(av2,39334+1,39334+18*24-7)+trim(39334+1,0)
trim(0,43695)+trim(av2,43695+1,43695+5*24)+trim(43695+1,0)
(...)
trim(0,137057)+trim(av2,137057+1,137666-4)+trim(137057+1,0)
trim(0,137907)+trim(av2,137907+1,138531-1)+trim(137907+1,0)
trim(0,139372)+trim(av2,139372+1,139665)+trim(139372+1,0)
trim(0,141478)+trim(av2,141478+1,142295)+trim(141478+1,0)
trim(0,145026)+trim(av2,145026+1,145411+8)+trim(145026+1,0)
trim(0,149794)+trim(av2,149794+1,150601+48+19)+trim(149794+1,0)
trim(0,151913)+trim(av2,151913+1,151913+24*13+38)+trim(151913+1,0)
trim(0,155769)+trim(av2,155769+1,155769+24*32-14)+trim(155769+1,0)
trim(0,157588)+trim(av2,157588+1,158418)+trim(157683,0)
trim(0,158766)+trim(av2,158766+1,158986)+trim(158766+1,0)
trim(0,160356)+trim(av2,160356+1,160356+24*14-6)+trim(160356+1,0)
trim(0,161050)+trim(av2,161050+1,161976)+trim(161050+1,0)
trim(0,162076)+trim(av2,162076+1,162205+24+25)+trim(162076+1,0)

delayaudio(32*0.0417)
killvideo()
Is it possible to automatize this or do any of your tools facilitate the process?
Dogway is offline   Reply With Quote
Reply

Tags
averageluma, correlation, lumadifference, runtime


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 13:17.


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