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. |
30th March 2015, 00:44 | #22 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
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. 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 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 }
__________________
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. |
30th March 2015, 12:56 | #23 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
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 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. |
1st April 2015, 19:16 | #24 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
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 ??? |
21st December 2018, 00:24 | #25 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
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 ??? |
27th July 2021, 21:41 | #27 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
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.
__________________
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. |
28th July 2021, 12:41 | #28 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
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 ??? |
10th December 2021, 12:07 | #30 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
From post #22
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 Above uses Nicknames, might be more usual to use clip index numbers. Scriptor can create command file via some detect script. Its for scriptors/scriptess's, if you dont know what you want it for then you probably dont need it. EDIT: SelectRanges/RejectRanges, functions using Prune[also requires FrameSel and RT_Stats]:- https://forum.doom9.org/showthread.p...59#post1683559 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(Last,scmd=SCmd,cmd=Cmd,reject=true) \ : FrameSel_CmdReWrite(Last,PruneCmd,scmd=SCmd,cmd=Cmd,reject=true,Prune=True,range=true) (TrimAudio) ? Prune(Last,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 } Code:
avisource("d:\avs\flashtest.avi").trim(1000,-20).showframenumber # 20 frames SCMD=""" # This is a comment 1 # delete frame 1 9 # delete frame 9 11,15 # delete range 11 to 15 """ # del.txt = file containing eg "3"+chr(10)+"5"+chr(10)+"7"+chr(10) RejectRanges(scmd=SCMD,cmd="del.txt") # Delete frames 1 & 9, 11 to 15, and frames in del.txt 3 and 5 and 7, trim audio 1 ms fade #RejectRanges(scmd="1;9;11,15",cmd="del.txt") # Exactly the same as above SelectRanges, Script function to select ranges from clip, together with audio. Code:
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(Last,scmd=SCmd,cmd=Cmd,Ordered=Ordered) \ : FrameSel_CmdReWrite(Last,PruneCmd,scmd=SCmd,cmd=Cmd,Ordered=Ordered,Prune=True,range=true) (TrimAudio) ? Prune(Last,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 } Client script for SelectRanges Code:
avisource("d:\avs\flashtest.avi").trim(1000,-20).showframenumber # 20 frames SCMD=""" # This is a comment 1,3 # Select Range 1 to 3 9,11 # Select Range 9 to 11 14,15 # Select Range 14 to 15 2,5 # Select Range 2 to 5, If Ordered==True then already previously selected 1st range above (1,3) extended to 1,5 """ ORDERED=True SelectRanges(scmd=SCMD,Ordered=ORDERED) # Select SCmd ranges, trim audio 1 ms fade. #SelectRanges(scmd="1,3;9,11;14,15;2,5",Ordered=ORDERED) # Exactly the same as above Post #16, has template command file creator scripts, to delete or keep frames based on some runtime function [eg AverageLuma, YDifferenceFromPrevious, etc]. https://forum.doom9.org/showthread.p...98#post1539598 EDIT: Command Generator functions PruneGenny.avsi Code:
# PruneGenny.avsi Function PruneKeepFrames(clip c, string fileName, string condition, bool "Fast") { # Conditional KEEP frames Command File generator for Prune() # MUST call with correct colorspace for condition eg YDifferenceFromPrevious requires a Planar colorspace. # May require additional condition for end frames for eg YDifferenceFromPrevious and YDifferenceToNext. # Any-DifferenceFromPrevious, # Gives 0 for frame zero and so you may want to add to condition " || current_frame==0" to include frame 0. # Any-DifferenceToNext, # Gives 0 for last frame and so you may want to add to condition " || current_frame==framecount-1 " to include last frame. c=(Default(Fast,true))?c.AssumeFPS(250.0):c # Fast as we can if Fast = true (Default true) WriteFileIf(c, fileName, condition, """ "0," """, "current_frame", append=false) } Function PruneDeleteFrames(clip c, string fileName, string condition, bool "Fast") { # Conditional DELETE frames Command File generator for Prune() # MUST call with correct colorspace for condition eg YDifferenceFromPrevious requires a Planar colorspace. # Is EXACT opposite of PruneKeepFrames() for same conditional. # NOTE, any additional end frame condition as used in PruneKeepFrames, will also be inverted # eg " || current_frame==0", frame 0 would be deleted. c=(Default(Fast,true))?c.AssumeFPS(250.0):c # Fast as we can if Fast = true (Default true) condition = "!(" + condition + ")" WriteFileIf(c, fileName, condition, """ "0," """, "current_frame", append=false) } ########################### # Below :HINT ON USE: /* ################ Avisource("In.avi").ConvertToYV12() # Planar Required for AverageLuma and YDifferenceFromPrevious ##### pick one of below [can replace 0.1 with whatever threshold you like] #PruneKeepFrames(".\cmd.txt","AverageLuma>=0.1") #PruneDeleteFrames(".\cmd.txt","AverageLuma>=0.1") ##### Or with additional conditional for end frame [YDifferenceFromPrevious ALWAYS 0.0 on frame 0, YDifferenceToNext ALWAYS 0.0 on last frame] #PruneKeepFrames(".\cmd.txt","YDifferenceFromPrevious>=0.1 || current_frame==0") # Always keeps first frame 0 (else delete) #PruneDeleteFrames(".\cmd.txt","YDifferenceFromPrevious>=0.1 || current_frame==0") # Always deletes first frame 0 (else keep) #PruneKeepFrames(".\cmd.txt","YDifferenceToNext>=0.1 || current_frame==framecount-1") # Always keeps last frame (else delete) #PruneDeleteFrames(".\cmd.txt","YDifferenceToNext>=0.1 || current_frame==framecount-1") # Always deletes last frame (else keep) Return last ##### And Pass2 Avisource("In.avi") #.ConvertToYV12() # Planar Required for AverageLuma and YDifferenceFromPrevious NOT REQUIRED HERE Return Prune(cmd=".\cmd.txt") ################ */ Code:
# Import(".\PruneGenny.avsi" Avisource("In.avi").ConvertToYV12() # Planar Required for AverageLuma and YDifferenceFromPrevious # pick one of below [can replace 0.1 with whatever threshold you like] #PruneKeepFrames(".\cmd.txt","AverageLuma>=0.1") #PruneDeleteFrames(".\cmd.txt","AverageLuma>=0.1") # Or with additional conditional for end frame [YDifferenceFromPrevious ALWAYS 0.0 on frame 0, YDifferenceToNext ALWAYS 0.0 on last frame] #PruneKeepFrames(".\cmd.txt","YDifferenceFromPrevious>=0.1 || current_frame==0") # Always keeps first frame 0 (else delete) #PruneDeleteFrames(".\cmd.txt","YDifferenceFromPrevious>=0.1 || current_frame==0") # Always deletes first frame 0 (else keep) #PruneKeepFrames(".\cmd.txt","YDifferenceToNext>=0.1 || current_frame==framecount-1") # Always keeps last frame (else delete) #PruneDeleteFrames(".\cmd.txt","YDifferenceToNext>=0.1 || current_frame==framecount-1") # Always deletes last frame (else keep) Return last Code:
Avisource("In.avi") #.ConvertToYV12() # Planar Required for AverageLuma and YDifferenceFromPrevious NOT REQUIRED HERE Return Prune(cmd=".\cmd.txt") Below from another thread: http://forum.doom9.org/showthread.php?t=165345 Where a user wanted to delete based on a averageLuma of cropped area Code:
# PASS 1 source=avisource("D:\avs\avi\1.avi").ConvertToYV12() X = 40 # X-Coord of Crop area, For your Area of Interest. Y = 40 # Y-Coord of Crop area W = 32 # Width of Crop area, YV12, MOD4 H = 32 # Height of Crop area, YV12, MOD4 METRICS = True # True To Show Metrics (NO Pass1 CMD file Created) DIM = True # True will dim NON Area Of Interest when viewing Metrics Thresh = 128.0 # 0.0 -> 255.0, Threshold for frame drops. SET using view metrics ALIGN = 7 # METRICS SubTitle Alignment 7=TopLeft, 1=BotLeft (As KeyPad) # ----------------------- cropped=source.Crop(X,Y,W,H) # Your area of interest source = (DIM) ? source.levels(0,1.0,255,0,128).Overlay(cropped,x=X,y=Y,opacity=1.0) : source Return (METRICS)\ ? source.ScriptClip(""" TmpAL=cropped.AverageLuma() Subtitle(String(TmpAL) + ((TmpAL>Thresh)?" DROP":""),align=ALIGN)""" ) \ : cropped.PruneDeleteFrames(".\cmd.txt","AverageLuma>Thresh",Fast=True) Code:
avisource("D:\avs\avi\1.avi") # .ConvertToYV12(), Not Necessary here. Return Prune(cmd=".\Cmd.txt")
__________________
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; 10th December 2021 at 15:22. |
1st January 2022, 11:13 | #31 | Link |
Registered User
Join Date: May 2019
Posts: 18
|
Only the "R0" line can be executed. Help me see what's wrong
------------------------------------------------------- v=directshowsource("I:\test\002\001.mp4") SCmd=" R0 0,2200 R1 6150,9150 R2 9300,12425 R3 15075,19125 " Prune(v,SCmd=SCmd, Show=true, Ver=true, dv=4, NoErr=true, Fade=25.0, FadeIn=true, FadeSplice=false, FadeOut=false, Nickname="") --------------------------------------------------------------- |
1st January 2022, 11:49 | #32 | Link |
Banana User
Join Date: Sep 2008
Posts: 989
|
Shouldn't it be like this:
Code:
SCmd=""" R0 0,2200 R1 6150,9150 R2 9300,12425 R3 15075,19125 """
__________________
InpaintDelogo, DoomDelogo, JerkyWEB Fixer, Standalone Faster-Whisper - AI subtitling |
1st January 2022, 12:47 | #33 | Link | ||
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
SCmd="""
R0 0,2200 R1 6150,9150 R2 9300,12425 R3 15075,19125 """ Either single or triple quotes ok there [only requires triple if eg double quote in a comment]. Above same as SCmd=""" 0 0,2200 1 6150,9150 2 9300,12425 3 15075,19125 """ where R0 or 0 is clip index [R0 is a reserved name for clip 0], However, Quote:
Eg, Code:
v=directshowsource("I:\test\002\001.mp4") v1 = v.Fliphorizontal v2 = v.Flipvertical v3 = v.Invert SCmd=" R0 0,2200 R1 6150,9150 R2 9300,12425 R3 15075,19125 " Prune(v,v1,v2,v3, SCmd=SCmd, Show=true, Ver=true, dv=4, NoErr=true, Fade=25.0, FadeIn=true, FadeSplice=false, FadeOut=false, Nickname="") EDIT: If you want only single clip trim/splice Code:
v=directshowsource("I:\test\002\001.mp4") SCmd=" # OR R0 0,2200 # 0 0,2200 R0 6150,9150 # 0 6150,9150 R0 9300,12425 # 0 9300,12425 R0 15075,19125 # 0 0,15075,19125 " Prune(v, SCmd=SCmd, Show=true, Ver=true, dv=4, NoErr=true, Fade=25.0, FadeIn=true, FadeSplice=false, FadeOut=false, Nickname="") Code:
v=directshowsource("I:\test\002\001.mp4") SCmd=" 0,2200 6150,9150 9300,12425 15075,19125 " SelectRanges(v, SCmd=SCmd) Prunes clip index's are for where you have multiple source clips. EDIT: Quote:
in above script, the R1, R2, and R3 ranges will simply be ignored [because you did not provide those source clips]. The output to DebugView [google debugview] will show the commands that are ignored because you told it to ignore errors. [Implemented as per Cretindesalpes request for same NoErr in ClipClop plugin]. From docs Code:
NoErr, bool, Default false false = Stop on ANY command error. (usual mode) You will be informed in DebugView which (if any) errors can be ignored if switched to NoErr==true. true = Suppress trivial errors where possible. Only use after you have viewed and dismissed as unimportant any DebugView errors displayed when NoErr==false. Not all errors are ignorable. and tell you if those errors can be ignored when you set NoErr=True. IIRC, when you set NoErr=False, it will show in DebugView all errors in command, before eventual error abort with the first encountered error, as message.
__________________
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; 1st January 2022 at 19:17. |
||
1st January 2022, 18:52 | #34 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
I'm sure you meant to write Code:
v=directshowsource("I:\test\002\001.mp4") v1 = v.Fliphorizontal v2 = v.Flipvertical v3 = v.Invert ... |
|
1st January 2022, 19:18 | #35 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Yep, thanks Big G, fixed.
And a Happy New Year to you too
__________________
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 ??? |
Tags |
editing, range, splice, trim |
Thread Tools | Search this Thread |
Display Modes | |
|
|