View Single Post
Old 30th August 2017, 23:02   #11  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
SawBones/FrameSurgeon v1.04, new version see 1st post.
Posts #1 to #4 updated.

MAIN difference, can within Sawbones press a key combo to Save contents of NotePad Command file, and auto
refresh avs into VirtualDubFilterMod (now almost a requirement), so you can see edits that you have already done.
(Replacements and Interpolations done, and deletions marked (subtitled) but not actually deleted until FrameSurgeon called with
FINAL=True)


FrameSurgeon_DEMO.avs
Code:
Import("../FrameSurgeon.avs")

### Config #############################################
FINAL=False                 # Change to TRUE to do real DELETES (FALSE only shows where deletes would occur, ALWAYS use FALSE with SawBones)
### One of below strings
SCMD="""                 # Demo Test
    CP  100              # CP, Single frame args ONLY. Replace 100 with frame 99.
    CN  101              # CN, Single frame args ONLY. REplace 101 with frame 102.
    I9  110              # Id, Single frame args ONLY. Interpolate 9 frames starting at frame 110.
    FX1 200,299          # Replace 200->299 with same range from FX1 clip. (FXd clips default source if not supplied, Subtitled if Show)
    FX2 300,399
    FX3 400,499
    FX4 500,-50          # Replace 50 frames starting at 500.
    FX5 550,-50          # Replace 50 frames starting at 550. NOTE, as not defined in this script FX5 defaults Subtitled source clip.
    FX6 600,-100         # Replace 100 frames starting at 600. NOTE, as not defined in this script FX6 defaults Subtitled source clip.
    FX7 700,-100         # Replace 100 frames starting at 700. NOTE, as not defined in this script FX7 defaults Subtitled source clip.
    DEL 800,899
    DEL 900,-100         # Del 100 frames starting from 900
    DEL 2000,0           # Del from 2000 to end of clip.
"""
#SCMD=""

### One of below strings (CMD file is processed before SCMD, where multiple replacements on same frame)
CMD="FrameSurgeon_DEMO_Cmd.TXT" # Command file, perhaps created via SawBones.
#CMD = ""

SHOW=!FINAL                 # Show ClipClop OR Prune Metrics
SHOWMODE=0                  # 0=ClipClop metrics, 1=Prune Metrics (Show remaining after deletions rather than replacements)
DV=4                        # 0=ERRORS ONLY, 4=FULL Debug to DebugView(Google)
NOERR=False                 # Set True if wanting to IGNORE FXd commands for undefined FXd clips.

# MvTools, Interpolate args (see mvTools)
PEL=2
SHARP=2
RFILTER=2
ML=100.0
#
STACK=(!FINAL || SHOW)          # Auto stack window OFF when FINAL==True and SHOW==FALSE
########################################################

### Source clip ###
src=Colorbars.killaudio.ConvertToYV12
src=src.ShowFrameNumber(Size=src.Height/6,x=src.Width/2,y=src.Height/3)

### Simulated replacement clips ###
FX1 = src.FlipVertical
FX2 = src.FlipHorizontal
FX3 = src.Blur(1.58).Blur(1.58).Blur(1.58).Blur(1.58).Blur(1.58).Blur(1.58).Blur(1.58).Blur(1.58).Blur(1.58).Blur(1.58).Blur(1.58)
FX4 = src.Sharpen(1.0).Sharpen(1.0).Sharpen(1.0)

### Edit or No Edit ###
CMD=(CMD!="") ? RT_GetFullPathName(CMD) : ""
PROCESS = (SCMD!="" || (CMD!="" && Exist(CMD)))     # Skip FrameSurgeon if no String nor file commands (yet).

Result = (PROCESS)
        \ ? FrameSurgeon(src,scmd=SCMD,cmd=CMD,Show=Show,ShowMode=SHOWMODE,dv=DV,
        \   fx1=FX1,fx2=FX2,fx3=FX3,fx4=FX4,
        \   pel=PEL,sharp=SHARP,rfilter=RFILTER,ml=ML,
        \   Final=FINAL,NoErr=NOERR)
        \ : src

### Stack For View ###
BSZ=4 BCOL=$FF00FF
Ssrc=src.RtSub("Source",True)   SFX1=FX1.RtSub("FX1",True)  SFX2=FX2.RtSub("FX2",True)
SFX3=FX3.RtSub("FX3",True)      SFX4=FX4.RtSub("FX4",True)  SResult=Result.RtSub("Result",True)
TOP=StackHorizontal(Ssrc,Ssrc.BlankClip(width=BSZ,Color=BCOL),SFX1,Ssrc.BlankClip(width=BSZ,Color=BCOL),SFX2)
BOT=StackHorizontal(SFX3,Ssrc.BlankClip(width=BSZ,Color=BCOL),SFX4,Ssrc.BlankClip(width=BSZ,Color=BCOL),SResult)
Return (STACK) ? StackVertical(TOP,TOP.BlankClip(height=BSZ,Color=BCOL),BOT) : Result

# Stack Overhead RT_Subtitle Text, with optional FrameNumber shown.
Function RtSub(clip c,string Tit, Bool "ShowFrameNo") {
    c.BlankClip(height=20)
    (Default(ShowFrameNo,False)) ? ScriptClip("""RT_Subtitle("%d] %s",current_frame,""""+Tit+"""")""") : RT_Subtitle("%s",Tit)
    Return StackVertical(c).AudioDubEx(c)
}

Return Last
FrameSurgeon_DEMO_Cmd.txt
Code:
CP  1000             # CP, Single frame args ONLY. Replace 1000 with frame 999.
CN  1001             # CN, Single frame args ONLY. REplace 1010 with frame 1002.
I9  1010             # Id, Single frame args ONLY. Interpolate 9 frames starting at frame 1010.
FX1 1200,1299        # Replace 1200->1299 with same range from FX1 clip. (FXd clips default source if not supplied, Subtitled if Show)
FX2 1300,1399
FX3 1400,1499
FX4 1500,-100        # Replace 100 frames starting at 1500.
FX5 1600,-50         # Replace 50 frames starting at 1600. # NOTE FX5 NOT defined in script
DEL 1700,1799
DEL 1800,-100        # Del 100 frames starting from 1800

SawBones_DEMO.avs
Code:
Import("../FrameSurgeon.avs")

### Config ###
FINAL=False                 # Change to TRUE to do real DELETES (FALSE only shows where deletes would occur, ALWAYS use FALSE with SawBones)
SCMD=""                     # Not Using SCMD (string command) in this DEMO
CMD="SawBones_DEMO_Cmd.txt" # Command file, perhaps created via SawBones.
SHOW=!FINAL                 # Show ClipClop OR Prune Metrics
SHOWMODE=0                  # 0=ClipClop metrics, 1=Prune Metrics (Show remaining after deletions rather than replacements)
DV=4                        # 0=ERRORS ONLY, 4=FULL Debug to DebugView(Google)
NOERR=False                 # Set True if wanting to IGNORE FXd commands for undefined FXd clips.
                            #     (In DEMO, FX9 command is used in CMD but not supplied in FrameSurgeon call, set True to ignore that command)
# MvTools, Interpolate args (see mvTools)
PEL=2
SHARP=2
RFILTER=2
ML=100.0
#
STACK=(!FINAL || SHOW)          # Auto stack window OFF when FINAL==True and SHOW==FALSE
##############

### Source clip ###
src=Colorbars.killaudio.ConvertToYV12
src=src.ShowFrameNumber(Size=src.Height/6,x=src.Width/2,y=src.Height/3)

### Simulated replacement clips ###
FX1=src.FlipHorizontal          # Light denoising or whatver
FX2=FX1.FlipVertical            # Heavy denoising or whatver

### Edit or No Edit ###
CMD=(CMD!="") ? RT_GetFullPathName(CMD) : ""
PROCESS = (SCMD!="" || (CMD!="" && Exist(CMD)))     # Skip FrameSurgeon if no String nor file commands (yet).

Result = (PROCESS)
        \ ? FrameSurgeon(src,scmd=SCMD,cmd=CMD,Show=Show,ShowMode=SHOWMODE,dv=DV,
        \   fx1=FX1,fx2=FX2,
        \   pel=PEL,sharp=SHARP,rfilter=RFILTER,ml=ML,
        \   Final=FINAL,NoErr=NOERR)
        \ : src

### Stack For View ###
BSZ=4 BCOL=$FF00FF
Ssrc=src.RtSub("Source",True)   SFX1=FX1.RtSub("FX1",True)  SFX2=FX2.RtSub("FX2",True)  SResult=Result.RtSub("Result",True)
TOP=StackHorizontal(Ssrc,Ssrc.BlankClip(width=BSZ,Color=BCOL),SFX1)
BOT=StackHorizontal(SFX2,Ssrc.BlankClip(width=BSZ,Color=BCOL),SResult)
Return (STACK) ? StackVertical(TOP,TOP.BlankClip(height=BSZ,Color=BCOL),BOT) : Result

# Stack Overhead RT_Subtitle Text, with optional FrameNumber shown.
Function RtSub(clip c,string Tit, Bool "ShowFrameNo") {
    c.BlankClip(height=20)
    (Default(ShowFrameNo,False)) ? ScriptClip("""RT_Subtitle("%d] %s",current_frame,""""+Tit+"""")""") : RT_Subtitle("%s",Tit)
    Return StackVertical(c).AudioDubEx(c)
}

/*

    Can use above script where DEMO_Command.txt file does not exist and will not produce error, ie use same script and Demo_Command.txt
    with VirtualDubFilterMod, Sawbones, and NotePad.

      Sawbones v1.04, used with Notepad and VirtualDubFilterMod, "Save & Refresh avs" key combo 'CTRL/ALT/,' (COMMA by default, little SawBones.au3
    mod and rebuild maybe necessary for some international keyboards to select some key other than comma) saves the NotePad file, and if
    VDubFilterMod Script Editor window is open, then will send F5 key to the script editor window (ie Save AVS file and refresh, re-open at original
    frame). These mods will basically save the command file and then reload the AVS with range replacements already done.
    If using with SawBones and marking deletions, then ENSURE that FINAL=FALSE, which will only mark frames for deletion, otherwise further deletions
    or replacements later in clip will be wrong (VirtualDubFilteRMod/Sawbones, have no idea what editing has been done within Avisynth).

*/
SawBones_DEMO_CMD.TXT
Code:
DEL 1,4        # Delete frames 1 to 4 (AFTER ALL replacments done)
DEL 6,-2       # Delete 2 frames 6 to 7 (AFTER ALL replacments done)
DEL 8          # Delete frame 8 (AFTER ALL replacments done)
DEL 400,449    # Delete frames 400 to 449 (AFTER ALL replacments done)
I3  10         # Interp 3 frames 10 -> 12, using 9 and 13 as source
I   20,28      # Interp 9 frames 20 -> 28, using 19 and 29 as source
I   30,-5      # Interp 5 frames 30 -> 34, using 29 and 35 as source
CP  40         # Replace frame 40 with frame 39
CN  41         # Replace frame 41 with frame 42
FX1 50,199     # replace range 50,199 with same range from FX1 clip
FX1 250,-50    # replace 50 frames range 250,299 with same range from FX1 clip
DEL 1000,-1000 # Delete frames 1000 to 1999 (AFTER ALL replacments done)
FX2 300,599    # replace range 300,599 with same range from FX2 clip
FX9 700,-100   # Replace range 700->799 with same range from FX9 clip (UNDEFINED in default demo, will show in demo subtitled as FX9)
DEL 10000,0    # Delete frames 10,000 to last frame (AFTER ALL replacments done)
SawBones_Usage.txt
Code:
Using Sawbones with this demo, (In brief)

Open SawBones_DEMO_Cmd.txt in NotePad, and move cursor to last line. Make window small, just showing about two lines, but leave open.
Open Sawbones_DEMO.avs in VirtualDubFilteRMod, and open the script editor window (tools menu, script Editor, can minimize to on TaskBar).
Resize VirtiualDubFilterMod so that you can see it together with small NotePad window open.
Open SawBones.

Continue. (see SawBones SawBones.ReadMe.Txt for available commands).
__________________
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; 31st August 2017 at 04:12.
StainlessS is offline   Reply With Quote