# =========================================================================== # # === avisynth_code.avs # # This file contains old avisynth-related code. Adapt it to your needs. # # Some snippets are stored here as well - for example, the “logo remover” # is just a black box. You can use it to cover the face of people, for # example. And you can chance the colour of the box too. (Mplayer does # something similar) # =========================================================================== #

# =========================================================================== #

# =========================================================================== # # === Handling crop-related actions # =========================================================================== # # See: avisynth.nl/index.php/Crop # =========================================================================== # # Crop(clip, “left”, “top”, “-right”, “-bottom”) # =========================================================================== # # Crop(4,1,-1,-5)

# Crop(5,1,-1,-8) # Crop(16,16,-16,-16) schneidet 16 Pixel von überall ab # crop(0,72,720,400) - schneidet oben 72 und unten 104 Pixel weg, bei 720x576 px # Crop(0,4,-0,-4) nur links und rechts # Crop(32,32,-32,-32) #32 überall

# =========================================================================== # # === Information (INFO TAG) # # This subsection deals with displaying more information about a video file. # =========================================================================== # # Displays info of a file: # # Usage example: # # AviSource(“C:filename.avi”).Info # # Info() # Write down info about file here: Color: YV12 wid576px hei432px Aud:48K/16Bit # Version() display the version of a file # =========================================================================== # # produces a blank clip (3000 frames, width 720, height 576, framerate 25), # with a silent audio track (16 bit 44.1 kHz stereo): # BlankClip( width=1, height=2, fps=10, color=$000000)# # BlankClip(width=30, height=20)# # BlankClip(clip “template”, int “length”, int “width”, int “height”, string “pixel_type”, float “fps”, int “fps_denominator”, int “audio_rate”, bool “stereo”, bool “sixteen_bit”, int “color”) # BlankClip()

# =========================================================================== # # === Handling plugins for avisynth # =========================================================================== # # LoadPlugin(“D:AVSPlugInsMPEG2Dec3.dll”) # LoadPlugin(“D:AVSPlugInsmpasourcempasource25.dll”)

# To load support for MPEG2 files in VirtualDub, try the following two # lines: # # LoadPlugin(“C:<wherever>mpeg2dec.dll”) # mpeg2source(“C:<wherever>file.mpg”)

# =========================================================================== # # # Important Links to Avisynth: # # www.avisynth.org/index.php?page=FilterNachKategorie # www.avisynth.org/index.php?page=AviSynthHandbuch # forum.doom9.org/showthread.php?s=&threadid=16662I # avisynth.org/mediawiki/Main_Page # # =========================================================================== #

# =========================================================================== # # SOURCE HANDLING AND CORE TESTING # =========================================================================== # # Simple example showcasing no audio, and forced RGB conversion: # AVIFileSource(“WttJ.avi”,false,“RGB32”) # =========================================================================== # # With AviSource you specify your input. Since i did this on windows, the # path names are silly ;) # # You can assign variables to it, and reuse them lateron though, which is # really cool. # =========================================================================== # # AviSource(“C:example.avi”) # =========================================================================== # video_file = “C:222_CurseOfTheGoldenFlower.avi”

# =========================================================================== # # === AviSource Tag # .Info gives you some video info about a file # AviSource(video_file).Info # Sometimes AviSource fails with “cannot assign to PCM blabla”, in this # case you can try if using DirectShowSource works instead of AviSource, # and you may have luck by installing LAME-ACM. # # Here, load the file you assigned as variable. # =========================================================================== # AviSource( video_file ).Info # DirectShowSource( video_file )

# =========================================================================== # # === LoadPlugin tag (plugin tag, plugins tag) # # LoadPlugin loads .dll plugins, like deinterlacers etc. # =========================================================================== # # LoadPlugin(“SmoothDeinterlacer.dll”)

# =========================================================================== # # === SmoothDeinterlace tag # Now apply a method, SmoothDeinterlace() to deinterlace your # video. (I think it blurs a tiny bit too, but not sure) # =========================================================================== # # SmoothDeinterlace()

# =========================================================================== # # SpatialSoften(clip clip, int radius, int luma_threshold, int chroma_threshold) # =========================================================================== #

# =========================================================================== # # MPEG HANDLING - MPEG ÖFFNEN # =========================================================================== # # DirectShowSource(“c:myclip.mpg”, fps=25)

# =========================================================================== # # SHEV’S LOGO REMOVER, as told by Wilbert on doom9.org: # =========================================================================== # # forum.doom9.org/showthread.php?s=&threadid=73597&highlight=logo+overlay # # text = BlankClip(width=80, height=40)#.Subtitle(“XXXX”) # Overlay(video,text,x=150,y=35,mode=“blend”,opacity=1.00)

# =========================================================================== # # More handles. For example, one video file, and another # audio file. # =========================================================================== # # video = AviSource(“C:Vampire2002.avi”) ### + AVISource(“capture2.avi”) # audio = WAVSource(“C:Vampire2002.avi”)

# =========================================================================== # # The method AudioDub: # =========================================================================== # # AudioDub combines video and audio, no matter the sources # See: http://www.avisynth.org/index.php?page=AudioDub+Deutsch

# =========================================================================== # # AudioDub(video, audio) # return video # =========================================================================== #

# =========================================================================== # # AUDIO SECTION AUDIO TAG # =========================================================================== # If you assign two vars, like in: video = AVISource(“somevideo.avi”);audio = WAVSource(“music.wav”) then you can mux it together using AudioDub: AudioDub(video, audio) # =========================================================================== #

# # Further support for MPEG2 Scripting: # Bei Mpeg2 sollte man darauf achten, das so gecroppt wird, das Höhe und # Breite ein Vielfaches von 16 sind! JumpTo Bicubic R # video = mpeg2source(“C:STDx.d2v”)+mpeg2source(“d:teil_2.d2v”) audio = WAVSource(“C:STDnet3.wav”) # DelayAudio(audio,-0.182) AudioDub(video, audio) # =========================================================================== #

# =========================================================================== # # RGB Adjust multipliziert jeden Farbkanal mit den vorgegeben # Faktor. Das Ergebnis ist auf 255 begrenzt. Funktioniert aber # nur bei RGB Color, nit bei YUV. # www.avisynth.org/index.php?page=RGBAdjust+Deutsch # =========================================================================== #

RGBAdjust(clip, float “red”, float “green”, float “blue”, float “alpha”) RGBAdjust(1,1,1,1) verändert den Clip nicht. RGBAdjust(100,1,1,1)

# =========================================================================== # # Mit diesen Funktionen können externe Filter und Plugins # zu AviSynth hinzugefügt werden. # =========================================================================== # LoadPlugin(“c:ProgrammeAviSynthpluginsxlogo.dll”) LoadPlugin (“dateiname”) Xlogo(X, Y, ALPHA, T1, T2, T3, B1, B2, B3, WHITE, SIDE, SCENE, FEATHER, NOISE) Xlogo(“e:guides000000.bmp”, 530, 38, 0) # Xlogo converts internally to RGB32

# =========================================================================== # # OVERLAY TAG: # =========================================================================== # # www.avisynth.org/index.php?page=Overlay+Deutsch # Overlay puts 2 clips on top of each other. # Nice little fun thing # =========================================================================== # Overlay (and blankclip).

# =========================================================================== # # BLACK_BOX = BlankClip(bg).Subtitle(“Hello, I am alive.”, text_color=$00FF00, x=100, y=200) # =========================================================================== # Overlay(bg,BLACK_BOX,x=50,y=20,mode=“subtract”,opacity=0.25) Overlay(“X2.avi”,x=50,y=240,opacity=1.0,mode=“blend”) # =========================================================================== # Overlay(clip clip, clip overlay [,int x, int y, clip mask, float opacity, string mode, bool greymask, string output, bool ignore_conditional, bool pc_range]) Overlay(“X.avi”,“Y.avi”) # text,x=50,y=240,mode=“blend”,opacity=0.7)

# =========================================================================== # # GENERAL RESIZING HANDLING resize tag # =========================================================================== # # Intro # BilinearResize und BicubicResize ändern Aspect Ratio, wobei Bicubic Resize # langsamer ist, jedoch eine bessere Qualität bietet. Daher –> Empfohlen! # =========================================================================== # # BILINEAR RESIZING # =========================================================================== # # www.avisynth.org/index.php?page=Resize+Deutsch # =========================================================================== # #

# resize the dimensions of the video frame to 320x240 LanczosResize(320, 240) # =========================================================================== # # BilinearResize(clip, int “NEW WID”, int “NEW HEIGHT”) ############### BilinearResize(20,20) # =========================================================================== # #? skaliert eingehende Frames in eine beliebig andere Auflösung ############### # =========================================================================== # # BilinearResize(16,16) this crashed with welcome to jungle avi ############### # =========================================================================== # ReduceBy2(“X3.avi”) # Hier auch ein advanced ReduceBy2 handling: a = AVISource(“WttJ.avi”) Pfad des ersten Avis b = AVISource(“WttJ(xvid).avi”) Pfad des zweiten Avis StackHorizontal (a,b) Avis werden nebeneinander gesetzt ReduceBy2 Wiedergabe mit halber Grösse (nicht zwingend erfordelich, aber überschaubarer) SwapUV() # War bei mir erforderlich, da die Farben nicht mehr stimmten (laut AviSynth-Doc ein Bug in DivX) # =========================================================================== # # BICUBIC RESIZING # # =========================================================================== # # www.avisynth.org/index.php?page=Resize+Deutsch # =========================================================================== # # BicubicResize(640,368) - 16:9 Format, Höhe auf vielfaches von 16 gerundet

# =========================================================================== # # === Handle Audio-related aspects

# =========================================================================== # #$ans = 0video = AviSource(“C:Datei.avi”) stereo = WavSource(“C:Audio.wav”) stereo_amp = AmplifydB?(stereo, 3, 0) return AudioDub(video, stereo_amp)

Erhöht die Lautstärken der vorderen Kanäle um 3 dB:

video = AviSource(“C:Datei_6ch_wav.avi”) audio = WavSource(“C:Datei_6ch_wav.avi”) audio_amp = AmplifydB(audio, 3, 3, 3) return AudioDub(video, audio_amp) Animate(100,200,“Levels”, 0,1,255,0,255, 0,1,255,255,255)

# =========================================================================== # # UNALIGNED SPLICE # =========================================================================== # # UnAlignedSplice( AVISource(“TEST1.avi”),AVISource(“TEST2.avi”) ) # =========================================================================== # # SPLICING # =========================================================================== # # AlignedSplice(clip1, clip2) # UnAlignedSplice(AVISource(“X.avi”),AVISource(“X2.avi”)) # UnAlignedSplice(clip1, clip2)

# =========================================================================== # # LETTERBOX # =========================================================================== # Letterbox(clip, int top, int bottom, [int left, int right]) Dieses Filter erzeugt oben und unten einen schwarzen Rand mit top und bottom Pixel Höhe, optional auch rechts und links mit left und right Pixel Breite.

# =========================================================================== # # TRIMMING CROPPING CUTTING # =========================================================================== # # www.avisynth.org/index.php?page=Trim+Deutsch # =========================================================================== # # trim(clip, int first_frame, int -num_frame) # oder # trim(Anfangsbild, Endbild) # =========================================================================== # # Mit Trim kann man einen Clip schneiden. # Trim specifies what frames to KEEP. The following line keeps frames # [0, 12000], [20000, 32000], [44000, end] and then splices them # together, effectively removing frames [12001, 19999] and # [32000, 43999] # # NOTE: the interval notation [a, b] means all frames from a through b, # inclusive. # # # =========================================================================== # # Trim(0, 12000) ++ Trim(20000, 32000) ++ Trim(44000, 0) # Trim(6860,0) # ist 0 zuletzt gegeben, so wird das letzte frame als arg genommen # Trim(0,-1) # ImageWriter(“C:", 98, 100, ”ebmp“) Verknüpfen von Trim: trim(0,9999) + trim(15000,25000)+…

# =========================================================================== # # BORDERING,DEBUGGING,SUBTITLING AND COMPARING # =========================================================================== # # MessageClip Erzeugt einen Videoclip mit einer Textnachricht # =========================================================================== # # MessageClip(string message, int “width”, int “height”, bool # “shrink”, int “text_color”, int “halo_color”, int “bg_color”) # MessageClip(“Test Message”,100,200,,blue) # Subtitle(“Hello, World!”, text_color=$00FF00, x=100, y=200)

# =========================================================================== # # Reverse the clip: # =========================================================================== # Reverse()

# =========================================================================== # # === Add Borders to a video file

# =========================================================================== # http://www.avisynth.org/index.php?page=AddBorders+Deutsch# AddBorders fügt schwarze Ränder mit der angegebenen Anzahl von Pixel zum Bild dazu. AddBorders(clip, int “left”, int “top” [, int “right”, int “bottom”] [, int “color”]) AddBorders(clip clip, int left, int top, int right, int bottom [, int color]) AddBorders(4,4,4,4,color=$00FF00) für jeweils 4 px seiten borders AddBorders(0,4,0,4) Es wird oben und unten ein schwarzer Rand von 4 Pixeln hinzugefügt.

# =========================================================================== # # MOVING BLACK BOX # =========================================================================== # text = BlankClip(width=80, height=40)#.Subtitle(“XXXX”) version() <<=== video clip

# Mask needed for param list but not really used— # mask=blankclip(width=text.width, height=text.height,color=$ffffff)

Overlay(last,text,x=150,y=35,mode=“blend”,opacity=1.00)

– Animate from 1 to end overlay from x=1 to x=width – ### Animate(1,last.Framecount, \

# "Overlay",last,text,1,35,mask,1.00,"blend", \
#  last,text,last.width,35,mask,1.00,"blend")

MPEG2CONVERTER Final Script; LoadPlugin(“C:DownloadsAVSGENbinMPEG2DEC.dll”) LoadPlugin(“C:DownloadsAVSGENbinAVISynth_Spatial.dll”) vid = DirectShowSource(“C:universal.m2v”)

# the directshow can also be this: #DirectShowSource("c:\folder\myclip.mpg") #is necessary for MPEG files

aud = WAVSource(“C:universal.wav”) AudioDub(vid, aud) #

# =========================================================================== # UNDOCUMENTED FEATURES# Erhöht den Kontrast: Tweak(cont=5.4) http://www.avisynth.org/index.php?page=Tweak+Deutsch # =========================================================================== # Tweak(cont=1.01)

Levels(20,1,1,1,1)

Crop(12,10,230,300).BilinearResize(100,150) ColorBars(5,5) Histogram(mode=“levels”) KillAudio() FadeIn(350)

# Subtitle(“Hello, World!”, 100, 200, 0, \ # 999999, “Arial”, 24, $00FF00)

SelectEven / SelectOdd SelectEven(clip) SelectOdd(clip) SelectEven setzt ein Video aus den geradzahligen Frames des Quellvideos zusammen, SelectOdd aus den ungeradzahligen.

# =========================================================================== # # === Compare two avi files # =========================================================================== # a = AVISource(“Clip”) Pfad des ersten Avis b = AVISource(“Clip”) Pfad des zweiten Avis StackHorizontal (a,b) Avis werden nebeneinander gesetzt ReduceBy2 Wiedergabe mit halber Grösse (nicht zwingend erfordelich, aber überschaubarer) SwapUV() # War bei mir erforderlich, da die Farben nicht mehr stimmten (laut AviSynth-Doc ein Bug in DivX) # =========================================================================== #

# =========================================================================== # # AVI_VERGLEICHEN / Compare avi files # =========================================================================== # a = AVISource(“Clip”) Pfad des ersten Avis b = AVISource(“Clip”) Pfad des zweiten Avis c = AVISource(“Clip”) Pfad des drittes Avis d = AVISource(“Clip”) Pfad des viertes Avis StackVertical(StackHorizontal (a,b),StackHorizontal (c,d)) Avis werden nebeneinander und übereinander gesetzt #Öffnen tu ich das ganze dann z.B. mit VirtualDubMod :) # =========================================================================== # -END————————————————————————-#

# =========================================================================== # # Last but not least, two complete examples next: # =========================================================================== # # * LoadPlugin(“c:VideobearbeitungAvisynth Pluginsmpeg2dec3dg.dll”) * LoadPlugin(“c:VideobearbeitungAvisynth Pluginsmpasource25.dll”) * video = mpeg2source(“i:teil_1.d2v”) * audio = mpasource(“i:teil_1_182ms.mpa”, normalize=true).DelayAudio(-0.182) * AudioDub(video, audio) * crop(0,72,720,432) * BicubicResize(640,360) * AddBorders(0,4,0,4) * trim(0,32625) + trim(40875,87575)

Skript 2 mit mehreren Quelldateien und unterschiedlichen Delaywerten der einzelnen Audiostreams. # * LoadPlugin(“c:VideobearbeitungAvisynth Pluginsmpeg2dec3dg.dll”)

#* LoadPlugin("c:\Videobearbeitung\Avisynth Plugins\mpasource25.dll")
#* video = mpeg2source("i:\teil_1.d2v") + mpeg2source("i:\teil_2.d2v")
#* audio1 = mpasource("i:\teil_1_182ms.mpa", normalize=true).DelayAudio(-0.182)
#* audio2 = mpasource("i:\teil_2_-137ms.mpa", normalize=true).DelayAudio(0.137)
#* audio = audio1+audio2
#* AudioDub(video, audio)
#* crop(0,72,720,432)
#* BicubicResize(640,360)
#* AddBorders(0,4,0,4)
#* trim(0,32625) + trim(40875,87575)