<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://avisynth.nl/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://avisynth.nl/index.php?action=history&amp;feed=atom&amp;title=Script_examples</id>
		<title>Script examples - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://avisynth.nl/index.php?action=history&amp;feed=atom&amp;title=Script_examples"/>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php?title=Script_examples&amp;action=history"/>
		<updated>2026-04-07T18:47:52Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.19.24</generator>

	<entry>
		<id>http://avisynth.nl/index.php?title=Script_examples&amp;diff=7138&amp;oldid=prev</id>
		<title>Raffriff42: link fix</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php?title=Script_examples&amp;diff=7138&amp;oldid=prev"/>
				<updated>2015-11-12T08:01:58Z</updated>
		
		<summary type="html">&lt;p&gt;link fix&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 08:01, 12 November 2015&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 63:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 63:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; [[LoadPlugin]](&amp;quot;MPEG2DEC.dll&amp;quot;) &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; [[LoadPlugin]](&amp;quot;MPEG2DEC.dll&amp;quot;) &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; clip1 = [[Mpeg2Source]](&amp;quot;combine.d2v&amp;quot;).[[Crop]](16, 0, 688, 576).ConvertToRGB32&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; clip1 = [[&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;DGDecode/MPEG2Source|&lt;/ins&gt;Mpeg2Source]](&amp;quot;combine.d2v&amp;quot;).[[Crop]](16, 0, 688, 576).ConvertToRGB32&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; noise = AviSource(&amp;quot;noise.avs&amp;quot;).[[ConvertToRGB32]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; noise = AviSource(&amp;quot;noise.avs&amp;quot;).[[ConvertToRGB32]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; clip1 = clip1.[[Layer]](noise, &amp;quot;add&amp;quot;, 8, 0, 0, use_chroma=true)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; clip1 = clip1.[[Layer]](noise, &amp;quot;add&amp;quot;, 8, 0, 0, use_chroma=true)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Raffriff42</name></author>	</entry>

	<entry>
		<id>http://avisynth.nl/index.php?title=Script_examples&amp;diff=19&amp;oldid=prev</id>
		<title>Admin: 1 revision</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php?title=Script_examples&amp;diff=19&amp;oldid=prev"/>
				<updated>2013-05-09T15:01:12Z</updated>
		
		<summary type="html">&lt;p&gt;1 revision&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='1' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='1' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 15:01, 9 May 2013&lt;/td&gt;
			&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://avisynth.nl/index.php?title=Script_examples&amp;diff=18&amp;oldid=prev</id>
		<title>Wilbert: Undo revision 7033 by 125.161.21.148 (Talk)</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php?title=Script_examples&amp;diff=18&amp;oldid=prev"/>
				<updated>2011-05-11T17:39:43Z</updated>
		
		<summary type="html">&lt;p&gt;Undo revision 7033 by &lt;a href=&quot;/index.php/Special:Contributions/125.161.21.148&quot; title=&quot;Special:Contributions/125.161.21.148&quot;&gt;125.161.21.148&lt;/a&gt; (&lt;a href=&quot;/index.php?title=User_talk:125.161.21.148&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;User talk:125.161.21.148 (page does not exist)&quot;&gt;Talk&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Here are some examples of AviSynth scripts, grouped in categories of increasing complexity. First download and install AviSynth, then save these scripts with the file extension &amp;quot;.avs&amp;quot; and load them in your favorite video player or editor.&lt;br /&gt;
&lt;br /&gt;
== Simple examples ==&lt;br /&gt;
&lt;br /&gt;
=== Example 1: Cutting out sections ===&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 # This is a comment.  All lines starting with a '#' symbol are comments&lt;br /&gt;
 # and are ignored by AviSynth.&lt;br /&gt;
 &lt;br /&gt;
 # load the file &amp;quot;somevideo.avi&amp;quot; from the same directory as the script&lt;br /&gt;
 [[AviSource|AVISource]](&amp;quot;somevideo.avi&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 # Trim specifies what frames to KEEP.  The following line keeps frames&lt;br /&gt;
 # [0, 12000], [20000, 32000], [44000, end] and then splices them&lt;br /&gt;
 # together, effectively removing frames [12001, 19999] and&lt;br /&gt;
 # [32001, 43999]&lt;br /&gt;
 #&lt;br /&gt;
 # NOTE: the interval notation [a, b] means all frames from a through b,&lt;br /&gt;
 #       inclusive.&lt;br /&gt;
 #&lt;br /&gt;
 [[Trim]](0, 12000) ++ Trim(20000, 32000) ++ Trim(44000, 0)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Example 2: Resizing ===&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 AVISource(&amp;quot;somevideo.avi&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 # resize the dimensions of the video frame to 320x240&lt;br /&gt;
 [[Resize|LanczosResize]](320, 240)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Example 3: Dubbing audio ===&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 video = AVISource(&amp;quot;somevideo.avi&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 # we can load WAV files too&lt;br /&gt;
 audio = [[AviSource|WAVSource]](&amp;quot;music.wav&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 # mux the video and audio tracks together&lt;br /&gt;
 [[AudioDub]](video, audio)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Example 4: Adjusting brightness, removing noise, fading ===&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 AVISource(&amp;quot;somevideo.avi&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 # TemporalSoften is one of many noise-reducing filters&lt;br /&gt;
 [[Soften|TemporalSoften]](4, 4, 8, scenechange=15, mode=2)&lt;br /&gt;
 &lt;br /&gt;
 # increase the gamma (relative brightness) of the video&lt;br /&gt;
 [[Levels]](0, 1.2, 255, 0, 255)&lt;br /&gt;
 &lt;br /&gt;
 # fade-in the first 15 frames from black&lt;br /&gt;
 [[Fade|FadeIn]](15)&lt;br /&gt;
 &lt;br /&gt;
 # fade-out the last 15 frames to black&lt;br /&gt;
 [[Fade|FadeOut]](15)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== More complex examples ==&lt;br /&gt;
&lt;br /&gt;
=== Example 5: poptones' [[Layer]] example ===&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 [[LoadPlugin]](&amp;quot;MPEG2DEC.dll&amp;quot;) &lt;br /&gt;
 clip1 = [[Mpeg2Source]](&amp;quot;combine.d2v&amp;quot;).[[Crop]](16, 0, 688, 576).ConvertToRGB32&lt;br /&gt;
 noise = AviSource(&amp;quot;noise.avs&amp;quot;).[[ConvertToRGB32]]&lt;br /&gt;
 clip1 = clip1.[[Layer]](noise, &amp;quot;add&amp;quot;, 8, 0, 0, use_chroma=true)&lt;br /&gt;
 &lt;br /&gt;
 clip2 = clip1.[[Trim]](125766, 0)&lt;br /&gt;
 clip = clip1.Layer(clip2, &amp;quot;add&amp;quot;, 128, 0, 0, use_chroma=true).Trim(9180, \&lt;br /&gt;
     86780).[[AssumeFrameBased]].[[ComplementParity]].[[Bob]]&lt;br /&gt;
 &lt;br /&gt;
 # build de-logo mask&lt;br /&gt;
 logosrc = AviSource(&amp;quot;nologo.avi&amp;quot;).[[Weave]].ConvertToRGB32.[[Resize|BilinearResize]](59, 13)&lt;br /&gt;
 masklogo = AviSource(&amp;quot;whitelogo.avi&amp;quot;).ConvertToRGB32&lt;br /&gt;
 logo = logosrc.[[Layer|Mask]](masklogo).BilinearResize(60, 27)&lt;br /&gt;
 &lt;br /&gt;
 # now cover up that ugly white logo...&lt;br /&gt;
 clip = clip.Layer(logo, &amp;quot;add&amp;quot;, 255, 582, 36, use_chroma=true)&lt;br /&gt;
 &lt;br /&gt;
 blur = clip.[[GeneralConvolution]](0,&lt;br /&gt;
                  &amp;quot;10 10 10 10 10 &lt;br /&gt;
                  10 10 10 10 10&lt;br /&gt;
                  10 10 16 10 10&lt;br /&gt;
                  10 10 10 10 10&lt;br /&gt;
                  10 10 10 10 10&amp;quot;)&lt;br /&gt;
 # sobel edge detection... the power of the matrix!&lt;br /&gt;
 hor = clip.GeneralConvolution(0,&lt;br /&gt;
                  &amp;quot;-1  0  1&lt;br /&gt;
                   -2  0  2&lt;br /&gt;
                   -1  0  1&amp;quot;)&lt;br /&gt;
 vert = clip.GeneralConvolution(0,&lt;br /&gt;
                  &amp;quot;-1  -2  -1&lt;br /&gt;
                   0  0  0&lt;br /&gt;
                   1  2  1&amp;quot;)&lt;br /&gt;
 edgemask = hor.Layer(vert,&amp;quot;lighten&amp;quot;,255,0,0,1)&lt;br /&gt;
 &lt;br /&gt;
 # now sharpen up just the edges of the blurred image...&lt;br /&gt;
 clip = clip.Mask(edgemask)&lt;br /&gt;
 clip = blur.Layer(clip, &amp;quot;add&amp;quot;, 128, 0, 0)&lt;br /&gt;
 &lt;br /&gt;
 return clip&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example 6: Write  pictures with flash to images from full video ===&lt;br /&gt;
==== params.avs ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 filename=&amp;quot;somefile.avi&amp;quot;&lt;br /&gt;
 logfile=&amp;quot;output.txt&amp;quot; &lt;br /&gt;
 path=&amp;quot;P:\ath\To\Files\&amp;quot; &lt;br /&gt;
 lumathresh=80 &lt;br /&gt;
 imageprefix=&amp;quot;prefix_&amp;quot; &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== FindFlash.avs ====&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 Import(&amp;quot;Params.avs&amp;quot;)&lt;br /&gt;
 AviSource(path+filename).ConvertToYV12 &lt;br /&gt;
 WriteFileIf(path+logfile, &amp;quot;(AverageLuma&amp;gt;lumathresh) &amp;amp;&amp;amp; (YDifferenceToNext() &amp;gt; 0)&amp;quot;, &amp;quot;current_frame&amp;quot;,&amp;quot;space&amp;quot;, &amp;quot;current_frame&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== SaveFlash.avs ====&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 Import(&amp;quot;Params.avs&amp;quot;)&lt;br /&gt;
 AviSource(path+filename) &lt;br /&gt;
 ScriptClip(&amp;quot;&amp;quot;&amp;quot; ImageWriter(path+imageprefix,myvar, myvar, &amp;quot;bmp&amp;quot;,false) &amp;quot;&amp;quot;&amp;quot;)&lt;br /&gt;
 ConditionalReader(path+logfile, &amp;quot;myvar&amp;quot;, false) &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See Also: ==&lt;br /&gt;
&lt;br /&gt;
* See [[External plugins|shared functions]] (and external plugins) written and contributed by the AviSynth community&lt;br /&gt;
&lt;br /&gt;
[[Category:AviSynth_Usage]]&lt;/div&gt;</summary>
		<author><name>Wilbert</name></author>	</entry>

	</feed>