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 6th October 2014, 06:51   #21  |  Link
gnol009
Registered User
 
Join Date: Feb 2010
Posts: 11
Thank you very much. Work like a charm
gnol009 is offline   Reply With Quote
Old 30th March 2015, 00:44   #22  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,626
Prune(), New version v1.11, see 1st post.
Code:
27/Mar/2012 - ver 1.10      - Added Nicknames.
30/Mar/2015 - ver 1.11 - Added v2.6 dll. Shows Nicknames when Show.
v2.6 dll allows view metrics on v2.6 colorspace frames.

EDIT: Added to avs files

Code:
Avisource("D:\avs\test.avi")

ConvertToYV24       # v2.6

V0 = Last
V1 = FlipVertical 
V2 = FlipHorizontal
V3 = TurnRight.BilinearResize(Width,Height)
V4 = TurnLeft.BilinearResize(Width,Height)
V5 = Invert

NickNames ="""  # Psuedonyms for clips (clip index number)
    ButlinsBytheSea_76       = 0
    PontinsRainedOut_77      = 1
    BultinsBognorRegis_78    = 2 
    BultinsSkegness_79       = 3
    PontinsCamberSands_80    = 4 
    PontinsLowestoft_81      = 5
"""

SCMD="""          # Clip editing commands in string, can also use commands in file
    ButlinsBytheSea_76       500,600
    PontinsRainedOut_77      900,1000
    BultinsBognorRegis_78    1400,1600
    BultinsSkegness_79       2000,2400
    PontinsCamberSands_80    2640,3000
    PontinsLowestoft_81      4400,4800
    PontinsRainedOut_77      5000,5400
    5                        6000,6500    # clip index instead of nickname
    1                        6501,7000            
"""

SHOW=True

Prune(V0,V1,V2,V3,V4,V5,scmd=SCMD,nickname=NickNames,show=SHOW,FadeIn=True,FadeSplice=True,FadeOut=True)

return ConvertToRGB32   # For YV24 viewing
EDIT: Also added this [also included in FrameSel() plug zip]
Code:
Function RejectRanges(clip c,String "SCmd",String "Cmd",Bool "TrimAudio",Float "FadeMS") {
    # RejectRanges() by StainlessS. Required:- FrameSel, Prune, RT_Stats
    # Wrapper to delete frames/ranges along with audio, can supply frames/ranges in SCmd string And/Or Cmd file.
    #   The wrapper makes for easier usage of Prune() which supports up to 256 input clips, but requires a clip index,
    #   eg '3, 100,200' would specify clip 3, range 100 to 200. The wrapper does away with the necessity for the clip index as we
    #   are only using a single clip here. Prune also does not have a 'reject' arg to delete specified frames rather than select them,
    #   this wrapper also converts a list of frames to delete into a list of frames to select so that we can use Prune and its audio
    #   capability.
    #
    # SCmd: Frames/Ranges specified in String (Frames/Ranges either Chr(10) or ';' separated, infix ',' specifies range, eg 'start,end').
    # Cmd:  Frames/Ranges specified in file (one frame/range per line, comments also allowed, see FrameSel for Further info).
    # TrimAudio:
    #   True(default), deletes audio belonging to deleted frames
    #   False, returns original audio, probably out of sync.
    # FadeMS: (default 1.0 millisec). Linear Audio Fade duration at splices when TrimAudio==true, 0 = dont fade (might result in audio 'clicks/cracks').
    c
    TrimAudio=Default(TrimAudio,True)   # default true trims audio, false returns original audio (audiodubbed, as Framesel returns no audio)
    FadeMS=Float(Default(FadeMS,1.0))   # 1 millisecond linear fadeout/fadein at splices
    PruneCmd = (TrimAudio) ? "~Prune_"+RT_LocalTimeString+".txt" : ""
    (!TrimAudio)
        \ ? FrameSel(scmd=SCmd,cmd=Cmd,reject=true)
        \ : FrameSel_CmdReWrite(PruneCmd,scmd=SCmd,cmd=Cmd,reject=true,Prune=True,range=true)
    (TrimAudio) ? Prune(Cmd=PruneCmd,FadeIn=True,FadeSplice=True,FadeOut=True,Fade=FadeMS) : NOP
    # If TrimAudio==true then delete Prune temp file, Else restore original Audio to the now audio-less clip
    (TrimAudio)
        \ ? RT_FileDelete(PruneCmd)
        \ : (c.HasAudio) ? AudioDub(c) : NOP
    Return Last
}

Function SelectRanges(clip c,String "SCmd",String "Cmd",Bool "TrimAudio",Float "FadeMS",Bool "Ordered") {
    # SelectRanges() by StainlessS. Required:- FrameSel, Prune, RT_Stats
    # Wrapper to Select frames/ranges along with audio, can supply frames/ranges in SCmd string And/Or Cmd file.
    #   The wrapper makes for easier usage of Prune() which supports up to 256 input clips, but requires a clip index,
    #   eg '3, 100,200' would specify clip 3, range 100 to 200. The wrapper does away with the necessity for the clip index as we
    #   are only using a single clip here.
    #
    # SCmd: Frames/Ranges specified in String (Frames/Ranges either Chr(10) or ';' separated, infix ',' specifies range, eg 'start,end').
    # Cmd:  Frames/Ranges specified in file (one frame/range per line, comments allowed, see FrameSel for Further info).
    #  *** NOTE ***, If both Cmd and SCmd supplied AND Ordered == False, then will process Cmd file and then SCmd string afterwards, ie
    #    Will select ranges in Cmd file and in order specified (rather than auto ordering ranges) and then append ranges specified in
    #    SCmd string (and in order specified).
    # TrimAudio:
    #   True(default), selects audio belonging to selected frames/ranges
    #   False, returns original audio, probably out of sync (maybe totally out of whack if Ordered == false and selected ranges out of order).
    # FadeMS: (default 1.0 millisec). Linear Audio Fade duration at splices when TrimAudio==true, 0 = dont fade (might result in audio 'clicks/cracks').
    # Ordered:
    #   True(default), all frames/ranges are returned in sequencial order. Any frame specified more than once will return only 1 instance.
    #   False, All frames/Ranges are returned in specified order, Cmd processed first and then SCmd. Frames/ranges specified more than once
    #     will return multiple instances. Allows out-of-order trimming of clip, eg re-sequencing of scenes in movie.
    #
    # Does not make much sense to select individual frames with audio, best used with ranges.
    # Will coalesce individually selected adjacent frames/ranges before any Fade, ie only audio fade where sensible to do so.
    # TrimAudio==false with non Ordered selection will result in completely out of sync audio.
    c
    TrimAudio=Default(TrimAudio,True)   # default true trims audio, false returns original audio (audiodubbed, as Framesel returns no audio)
    FadeMS=Float(Default(FadeMS,1.0))   # 1 millisecond linear fadeout/fadein at splices
    Ordered=Default(Ordered,True)       # True (default) frames/ranges will be Ordered and selected only once even if specified more than once.
                                        # False, frames/ranges returned in specified order, Cmd processed 1st and then SCmd.
    PruneCmd = (TrimAudio) ? "~Prune_"+RT_LocalTimeString+".txt" : ""
    (!TrimAudio)
        \ ? FrameSel(scmd=SCmd,cmd=Cmd,Ordered=Ordered)
        \ : FrameSel_CmdReWrite(PruneCmd,scmd=SCmd,cmd=Cmd,Ordered=Ordered,Prune=True,range=true)
    (TrimAudio) ? Prune(Cmd=PruneCmd,FadeIn=True,FadeSplice=True,FadeOut=True,Fade=FadeMS) : NOP
    # If TrimAudio==true then delete Prune temp file, Else restore original Audio to the now audio-less clip
    (TrimAudio)
        \ ? RT_FileDelete(PruneCmd)
        \ : (c.HasAudio) ? AudioDub(c) : NOP
    Return Last
}
EDIT: Before anyone points it out, I know I've mis-spelt Butlins wrong in 1st script, just a test to see how observant you all are.
__________________
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; 30th March 2015 at 12:55.
StainlessS is offline   Reply With Quote
Old 30th March 2015, 12:56   #23  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,626
Here frame from supplied avs demo showing audio FadeSplice at 25.0 millisecs (default 1.0 ) duration, using DavidHorman Waveform plug,
3 video frames duration of audio displayed:


FadeSplice avoids 'clicks' and 'cracks' in audio due to splice where significant change in audio phase/amplitude across
the spliced frames. Showing three Tone waveforms Sawtooth, Square and Sine.

FadeSplice implemented due to this thread:- http://forum.doom9.org/showthread.php?t=162907

EDIT: And here script that produced above
Code:
# For testing Prune() Fade

# This script can crash in Avisynth v2.58 due to a bug in the audio Cache.
# It is more likely to happen if AudioGraph is used, so this is disabled for v2.58

# Multiple Scriptclip's can produce a RealTime Video Lag behind Audio if the machine is not powerfull enough
# to cope with it, If so, then try with a lower FPS clip. Output to saved file should be fine. 

FPS     = 10.0                              # Lower if Video Lags behind Audio
CHANS   = 1
HZ      = 48000
BIT16   = false
SHOW    = true          # true = Show Info
VER     = true          # true = Show Version
NOERR   = true          # true = ignore, Ignorable Errors
DV      = 2             # DebugView, 0=Off, 1=Show Errors, 2=Errors+Warnings,3=Info+Errors+Warnings,4 = Debug ie all
FADE    = 25.0          # Default 1 (1 millisecond)
FADEIN  = true          # default False, Fade in 1st frame (if FADE non zero).
FADESPLICE = true       # default False, Fade out/in splices (if FADE non zero).
FADEOUT = true          # default False, Fade out last frame (if FADE non zero).

R0=ColorBars(512,384).AssumeFPS(FPS)

R3=R0.FlipHorizontal().FlipVertical().AudioDub(Tone(3600.0,77.6,HZ,CHANS,"Square",level=0.55)).Trim(0,9999)
R2=R0.FlipVertical().AudioDub(Tone(3600.0,63.5,HZ,CHANS,"Sawtooth",level=0.65)).Trim(0,9999)
R1=R0.FlipHorizontal().AudioDub(Tone(3600.0,59.2,HZ,CHANS,"Triangle",level=0.75)).Trim(0,9999)
R0=R0.AudioDub(Tone(3600.0,53.7,HZ,CHANS,"sine",level=0.95)).Trim(0,9999)

R0=(BIT16) ?R0.ConvertAudioTo16bit(): R0
R1=(BIT16) ?R1.ConvertAudioTo16bit(): R1
R2=(BIT16) ?R2.ConvertAudioTo16bit(): R2
R3=(BIT16) ?R3.ConvertAudioTo16bit(): R3

R0=R0.ScriptClip("""subtitle(Align=5,size=48,"R0("+string(current_frame)+")")""")
R1=R1.ScriptClip("""subtitle(Align=5,size=48,"R1("+string(current_frame)+")")""")
R2=R2.ScriptClip("""subtitle(Align=5,size=48,"R2("+string(current_frame)+")")""")
R3=R3.ScriptClip("""subtitle(Align=5,size=48,"R3("+string(current_frame)+")")""")

cmd="Prune_Fade_Test_Cmd.txt"

SCmd="
    R0 1
    R1 2
    R2 3
    R3 4
    R0 5,6
    R1 7,10
    R2 12,17
    R3 2
    "

#cmd=""                 # Uncomment to switch Off Command file
#scmd=""                # Uncomment to switch Off Command String

Prune(R0,R1,R2,R3,CMD=Cmd,SCmd=SCmd,show=SHOW,ver=VER,Noerr=NOERR,dv=DV,fade=FADE,FadeIn=FADEIN,FadeSplice=FADESPLICE,FadeOut=FADEOUT)

# Not very interesting without the below Audio Graph in v2.58.
#(VersionNumber<> 2.58)?AudioGraph(1):Last       # AudioGraph more likely exposes Avisnynth v2.58 Audio Cache Bug
(VersionNumber<> 2.58)?waveform(1):Last            # waveform more likely exposes Avisnynth v2.58 Audio Cache Bug
Contents of additional file, Prune_Fade_Test_Cmd.txt
Code:
R0 77,-1
R1 34,-2
R2 150,-3
R3 66,-4
__________________
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; 21st December 2018 at 01:12.
StainlessS is offline   Reply With Quote
Old 1st April 2015, 19:16   #24  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,626
Prune v1.12, see 1st post.
Minor mod, Display NickNames in original casing when Show=true (was all uppercased).
__________________
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 21st December 2018, 00:24   #25  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,626
Prune v1.13, see first post.
Moved to VS2008, added version resource, and x64.
__________________
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 22nd December 2018, 00:36   #26  |  Link
gispos
Registered User
 
Join Date: Oct 2018
Location: Germany
Posts: 532
Very nice that you reworked your plugins and you now also offer in 64bit.
Thank you.
__________________
Live and let live
gispos is offline   Reply With Quote
Old 27th July 2021, 21:41   #27  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,626
Prune v1.14, see 1st post.
[Available only on MediaFire in sig below this post, having problems getting into my SendSpace account].

Code:
	27/Mar/2012 - ver 1.10      - Added Nicknames.
	30/Mar/2015 - ver 1.11 - Added v2.6 dll. Shows Nicknames when Show.
	01/Apr/2015 - ver 1.12 - Display Nicknames in original casing when Show.
	20/Dec/2018 - ver 1.13 - Moved to VS2008, Add x64.
	27/Jul/2021 - ver 1.14 - Add HBD text render [Show/Ver] using DDigit v2.0.
Would previously work just fine with HBD clips, except where Show = true OR Ver = True, ie printing metrics text on frame.
__________________
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; 27th July 2021 at 21:45.
StainlessS is offline   Reply With Quote
Old 28th July 2021, 12:41   #28  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,626
Just a heads up,
the 3 recently updated plugs, FrameSel, Prune, and ClipClop,
all show an older version and date in forum [Avisynth Usage] lists,
when thread is older than some age, thread titles cannot be updated, however shows
correct version and date on the first thread post.
Forum VBulletin software problem.
__________________
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
Reply

Tags
editing, range, splice, trim

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 11:42.


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