<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://www.avisynth.nl/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=ItaloFan</id>
	<title>Avisynth wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://www.avisynth.nl/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=ItaloFan"/>
	<link rel="alternate" type="text/html" href="http://www.avisynth.nl/index.php/Special:Contributions/ItaloFan"/>
	<updated>2026-08-03T21:32:53Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>http://www.avisynth.nl/index.php?title=FAQ_loading_clips&amp;diff=10783</id>
		<title>FAQ loading clips</title>
		<link rel="alternate" type="text/html" href="http://www.avisynth.nl/index.php?title=FAQ_loading_clips&amp;diff=10783"/>
		<updated>2019-09-08T17:32:06Z</updated>

		<summary type="html">&lt;p&gt;ItaloFan: /* How do I load MP4/MKV/M2TS/EVO into AviSynth? */ fixed ffdshow link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;|[[AviSynth_FAQ | Main Page]] | [[FAQ_general_info | General Info]] | &#039;&#039;&#039;Loading clips&#039;&#039;&#039; | [[FAQ_frameserving | Loading Scripts]] | [[FAQ_common_errors | Common Error Messages]] | [[FAQ_different_types_content | Processing Different Content]] | [[FAQ_YV12 | Dealing with YV12]] | [[FAQ_using_virtualdub_plugins | Processing with Virtualdub Plugins]] |&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;div id=&amp;quot;media-formats&amp;quot;&amp;gt;Which media formats can be loaded in AviSynth?&amp;lt;/div&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Most video/audio formats can be loaded in AviSynth, but there are some exceptions like flv4 (VP6) and dvr-ms. If it is not possible to load a clip into AviSynth, you will have to convert it into some other format which can be loaded. Remember to choose a format for which you will have a minimal downgrade in quality as a result of the conversion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;div id=&amp;quot;ways-load&amp;quot;&amp;gt;Which possibilities exist to load my clip into AviSynth?&amp;lt;/div&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
In general there are three ways to load your video into AviSynth:&lt;br /&gt;
&lt;br /&gt;
# using an AviSynth internal filter or plugin which is designed to open some specific format.&lt;br /&gt;
# using the [[DirectShowSource]] plugin. &lt;br /&gt;
# using Graphedit.&lt;br /&gt;
&lt;br /&gt;
Make sure that your clip contains maximal one video and/or one audio stream (thus remove the subtitles and remove other video/audio streams). If you want to load a clip which contains both video and audio, you have two options:&lt;br /&gt;
&lt;br /&gt;
* Demux the audio stream and load the streams separately in AviSynth.&lt;br /&gt;
* Try to load the clip in AviSynth. This might or might not work. For AVIs, make sure you have a good AVI splitter installed, e.g. [http://sourceforge.net/project/showfiles.php?group_id=205650 Gabest&#039;s AVI splitter]. (Yes, Windows comes with an own AVI splitter, which will work in most cases.) &lt;br /&gt;
&lt;br /&gt;
When loading a clip into AviSynth it is advised to follow the following guidelines:&lt;br /&gt;
&lt;br /&gt;
* When it is possible to load your clip into AviSynth using either AviSource or a specific plugin then do so, since this is more reliable than the alternatives which are listed below.&lt;br /&gt;
* If the above fails, load your clip using the DirectShowSource plugin.&lt;br /&gt;
* If the above fails, create a Graphedit file connecting only the pins necessary to render the file.&lt;br /&gt;
* If the above fails, convert your clip into a different format (into one which is supported by AviSynth).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;div id=&amp;quot;adv-dss&amp;quot;&amp;gt;What are the advantages and disadvantages of using DirectShowSource to load your media files?&amp;lt;/div&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;advantages of DirectShowSource:&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Many video and audio formats are supported through DirectShowSource (have a look at ffdshow for example).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;disadvantages of DirectShowSource:&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* It&#039;s less reliable than AviSource and specific video/audio input plugins.&lt;br /&gt;
* Seeking problems.&lt;br /&gt;
* It might be much trouble to get specific DirectShow filter doing the decoding for you. In many cases you will have multiple decoders that can decode the same specific format. The one which will be used is the one with the highest merit (see below ...). It might be difficult to ensure that a specific decoder is doing the decoding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;div id=&amp;quot;direct-stream&amp;quot;&amp;gt;Has AviSynth a direct stream copy mode like VirtualDub?&amp;lt;/div&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
No, the video and the audio are decompressed when opening them into AviSynth.&lt;br /&gt;
&lt;br /&gt;
There is a modification of AviSynth v2.55 which supports &#039;direct stream copy&#039; for both video and audio. This modification is called DSynth and can be downloaded [http://esby.free.fr/ here]. Perhaps it will be updated and merged into the official AviSynth builds one day.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;div id=&amp;quot;avi&amp;quot;&amp;gt;How do I load AVI files into AviSynth?&amp;lt;/div&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Use [[AviSource]] to load your AVI files in AviSynth. Example:&lt;br /&gt;
&lt;br /&gt;
 AviSource(&amp;quot;d:\filename.avi&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
or without the audio:&lt;br /&gt;
&lt;br /&gt;
 AviSource(&amp;quot;d:\filename.avi&amp;quot;, false)&lt;br /&gt;
&lt;br /&gt;
If AviSynth is complaining about not being able to load your avi (couldn&#039;t decompress ...) you need to install an appropriate codec. [http://www.headbands.com/gspot/ GSpot], for example, will tell you what codec you need to install in order to be able to open your avi.&lt;br /&gt;
&lt;br /&gt;
Forcing a decoder being used for loading the clip into AviSynth:&lt;br /&gt;
&lt;br /&gt;
 # load your avi using the XviD codec:&lt;br /&gt;
 AviSource(&amp;quot;d:\filename.avi&amp;quot;, fourCC=&amp;quot;XVID&amp;quot;) # opens an avi (for example encoded with DivX3) using the XviD Codec&lt;br /&gt;
&lt;br /&gt;
 # load your dv-avi using the Canopus DV Codec:&lt;br /&gt;
 AviSource(&amp;quot;d:\filename.avi&amp;quot;, fourCC=&amp;quot;CDVC&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;div id=&amp;quot;avi-aud&amp;quot;&amp;gt;Can I load video with audio from AVI into AviSynth?&amp;lt;/div&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
It is always possible to demux your audio from the AVI file and load it separately in AviSynth using an audio decoder, but in some cases (for example: AVI with MP2/MP3/AC3/DTS audio) it is possible to load it directly in AviSynth.&lt;br /&gt;
&lt;br /&gt;
For loading your AVI with audio you need (1) a VfW (Video for Windows) codec to open (that is decode) your video in AviSynth and an ACM (Audio Compression Manager) codec to open your audio in AviSynth. For many video and audio format such codecs are available, but certainly not for all of them.&lt;br /&gt;
&lt;br /&gt;
[[Importing_media#AVI_with_audio|Here]] (...) you can find those codecs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;div id=&amp;quot;mpeg&amp;quot;&amp;gt;How do I load MPEG-1/MPEG-2/DVD VOB/TS/PVA into AviSynth?&amp;lt;/div&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
[[DGDecode]] is an external plugin and supports MPEG-1, MPEG-2 / VOB, TS (with MPEG-4 ASP video) and PVA streams. Open them into [[DGIndex]] first and create a D2V file which can be opened in AviSynth (note that it will only open the video into AviSynth):&lt;br /&gt;
&lt;br /&gt;
A few examples:&lt;br /&gt;
&lt;br /&gt;
 # DGDecode:&lt;br /&gt;
 LoadPlugin(&amp;quot;d:\dgdecode.dll&amp;quot;)&lt;br /&gt;
 MPEG2Source(&amp;quot;d:\filename.d2v&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
If your transport stream (*.TS) contains MPEG-4 AVC video you need to demux the raw video stream from it and use [[DGAVCDecode]] to open it in AviSynth. See [[#non-avi|here]] for its usage.&lt;br /&gt;
&lt;br /&gt;
Note:  [http://code.google.com/p/ffmpegsource/ FFMpegSource] is also an external plugin you can use for loading the above and more.  It does several Quicktime, AVI, MPEG, FLV, and others as well.  If you can&#039;t get the audio to load right, use FFVideoSource and FFAudioSource separate and it should work properly.  No issues with MPEG-1, 2, VOB, or TS.  Some issues on H.264, though, so DGAVCDecode is still the best for that.  FFMS will auto-index any file you put into it which is great for scripted conversions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;div id=&amp;quot;quickt&amp;quot;&amp;gt;How do I load QuickTime files into AviSynth?&amp;lt;/div&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
There are two ways to load your quicktime movies into AviSynth (and also RawSource for uncompressed movs): QTSource and QTReader. The former one is very recent and able to open many quicktime formats (with the possibility to open them as YUY2), but you need to install QuickTime player in order to be able to use this plugin. The latter one is very old, no installation of a player is required in order to be able to open quicktime formats in AviSynth.&lt;br /&gt;
&lt;br /&gt;
QTSource:&lt;br /&gt;
&lt;br /&gt;
You will need Quicktime 6 for getting video only or Quicktime 7 for getting audio and video.&lt;br /&gt;
&lt;br /&gt;
 # YUY2 (default):&lt;br /&gt;
 QTInput(&amp;quot;FileName.mov&amp;quot;, color=2)&lt;br /&gt;
 &lt;br /&gt;
 # with audio (in many cases possible with QuickTime 7)&lt;br /&gt;
 QTInput(&amp;quot;FileName.mov&amp;quot;, color=2, audio=1)&lt;br /&gt;
 &lt;br /&gt;
 # raw (with for example a YUYV format):&lt;br /&gt;
 QTInput(&amp;quot;FileName.mov&amp;quot;, color=2, mode=1, raw=&amp;quot;yuyv&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 # dither = 1; converts raw 10bit to 8bit video (v210 = 10bit uyvy):&lt;br /&gt;
 QTInput(&amp;quot;FileName.mov&amp;quot;, color=2, dither=1, raw=&amp;quot;v210&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
QTReader:&lt;br /&gt;
&lt;br /&gt;
If that doesn&#039;t work, or you don&#039;t have QuickTime, download the QTReader plugin (can be found in Dooms download section):&lt;br /&gt;
&lt;br /&gt;
 LoadVFAPIPlugin(&amp;quot;C:\QTReader\QTReader.vfp&amp;quot;, &amp;quot;QTReader&amp;quot;)&lt;br /&gt;
 QTReader(&amp;quot;C:\quicktime.mov&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;div id=&amp;quot;raw&amp;quot;&amp;gt;How do I load raw source video files into AviSynth?&amp;lt;/div&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
The external plugin RawSource supports all kinds of raw video files with the YUV4MPEG2 header and without header (video files which contains YUV2, YV16, YV12, RGB or Y8 video data).&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
 # This assumes there is a valid YUV4MPEG2-header inside:&lt;br /&gt;
 RawSource(&amp;quot;d:\yuv4mpeg.yuv&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 # A raw file with RGBA data:&lt;br /&gt;
 RawSource(&amp;quot;d:\src6_625.raw&amp;quot;,720,576,&amp;quot;BGRA&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 # You can enter the byte positions of the video frames directly (which can be found with yuvscan.exe).&lt;br /&gt;
 # This is useful if it&#039;s not really raw video, but e.g. uncompressed MOV files or a file with some kind of header:&lt;br /&gt;
 RawSource(&amp;quot;d:\yuv.mov&amp;quot;, 720, 576, &amp;quot;UYVY&amp;quot;, index=&amp;quot;0:192512 1:1021952 25:21120512 50:42048512 75:62976512&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;div id=&amp;quot;rm&amp;quot;&amp;gt;How do I load RM/RMVB (RealMedia) into AviSynth?&amp;lt;/div&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
RM/RMVB (RealMedia / RealMedia Variable Bitrate usually containing Real Video/Audio): install the [http://sourceforge.net/projects/guliverkli/ rmvb splitter] and the Real codecs by installing RealPlayer/[http://www.free-codecs.com/download/Real_Alternative.htm RealAlternative]. Create the script: &lt;br /&gt;
&lt;br /&gt;
 DirectShowSource(&amp;quot;d:\clip.rmvb&amp;quot;, fps=25, convertfps=true) # adjust fps if necessary&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;div id=&amp;quot;wmv&amp;quot;&amp;gt;How do I load Windows Media Video into AviSynth?&amp;lt;/div&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
WMV/ASF (Windows Media Video / Advanced Systems Format; usually containing WMV/WMA) is not fully supported by ffdshow, so you will have to install wmv codecs. Get [http://msdn.microsoft.com/en-us/library/dd757738%28v=vs.85%29.aspx WMF SDK v9 for W2K or later for XP/Vista] which contains the codecs (and the DMO wrappers necessary to use DMO filters in DirectShow). (Note that Microsoft&#039;s own VC1 codec is not supported in W2K since you need WMF SDK v11.) Create the script: &lt;br /&gt;
&lt;br /&gt;
 DirectShowSource(&amp;quot;d:\clip.wmv&amp;quot;, fps=25, convertfps=true) # adjust fps if necessary&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;div id=&amp;quot;non-avi&amp;quot;&amp;gt;How do I load MP4/MKV/M2TS/EVO into AviSynth?&amp;lt;/div&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
If your media file contains MPEG-4 ASP video, then there are two possibilities of opening them in AviSynth:&lt;br /&gt;
&lt;br /&gt;
1) Using the plugin [[FFmpegSource]]. All included dlls except ffmpegsource.dll should be copied to your system folder. Some examples:&lt;br /&gt;
&lt;br /&gt;
 # loading the video from MKV and returning a timecodes file:&lt;br /&gt;
 FFmpegSource(&amp;quot;D:\file.mkv&amp;quot;, vtrack = -1, atrack = -2, timecodes=&amp;quot;timecodes_file.txt&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 # loading the video and audio from a MP4 and returning a timecodes file:&lt;br /&gt;
 FFmpegSource(&amp;quot;D:\file_aac.mp4&amp;quot;, vtrack = -1, atrack = -1, timecodes=&amp;quot;timecodes_file.txt&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
It&#039;s important to generate a timecode file to check whether the video has a constant framerate. If this the case you don&#039;t need to use the timecode file and you can process the video in any way you want. However, many non-AVI files contain video with a variable framerate (AVI files always have a constant framerate though), and in that case you need to make sure of the following two things:&lt;br /&gt;
&lt;br /&gt;
* Don&#039;t change the framerate and the number of frames in AviSynth. If you do this (and you don&#039;t change the timecodes file manually) your video and audio in your final encoding will be out of sync.&lt;br /&gt;
* [[VFR#encoding_to_vfr_.28mkv.29|Use the timecodes file again]] when muxing your encoded video and audio. If you don&#039;t do this your video and audio in your final encoding will be out of sync.&lt;br /&gt;
&lt;br /&gt;
The main reason for this is that FFmpegSource opens the video as it is. It doesn&#039;t add or remove frames to convert it to constant framerate video to ensure sync.&lt;br /&gt;
&lt;br /&gt;
2) Get [[Ffdshow|ffdshow]] and open the MP4/MKV file with DirectShowSource, thus for example&lt;br /&gt;
&lt;br /&gt;
 DirectShowSource(&amp;quot;D:\file.mkv&amp;quot;, convertfps=true) # convertfps=true ensures sync if your video has a variable framerate&lt;br /&gt;
&lt;br /&gt;
If your media file contains MPEG-4 AVC video, then there are two possibilities of opening them in AviSynth:&lt;br /&gt;
&lt;br /&gt;
1) Using the plugin [[FFmpegSource]]. See above for its usage. At the moment, the supported containers are: AVI, MKV and MP4.&lt;br /&gt;
&lt;br /&gt;
2) Get [[DGAVCDecode]]. At the moment you need to extract the raw stream (*.264)  from the container first (using MKVExtract, MPlayer, TSRemux or whatever program can extract those streams). Open the raw stream file in DGAVCIndex to create an index file (say track1.dga). Open the index file in AviSynth:&lt;br /&gt;
&lt;br /&gt;
 # raw video demuxed from M2TS (Blu-ray BDAV MPEG-2 transport streams)&lt;br /&gt;
 LoadPlugin(&amp;quot;C:\Program Files\AviSynth\plugins\DGAVCDecode.dll&amp;quot;)&lt;br /&gt;
 AVCSource(&amp;quot;D:\track1.dga&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;div id=&amp;quot;wavpcm&amp;quot;&amp;gt;How do I load WAVE PCM files into AviSynth?&amp;lt;/div&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Use WavSource to open your WAVE PCM files (assuming that they are smaller than 4GB):&lt;br /&gt;
&lt;br /&gt;
 WavSource(&amp;quot;D:\file.wav&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Use the plugin RaWav to open your WAVE PCM files that are larger than 4GB ([http://dotwhat.net/w64/9033/ Sonic Foundry Video Editor Wave64 Files or W64]). The RaWavSource() load method are now included in [http://www.codeplex.com/NicAudio NicAudio 2.0] (see next point):&lt;br /&gt;
&lt;br /&gt;
 RaWavSource(&amp;quot;D:\file.w64&amp;quot;, SampleRate=96000, SampleBits=24, Channels=6)&lt;br /&gt;
 &lt;br /&gt;
 # or when a W64 header is present&lt;br /&gt;
 RaWavSource(&amp;quot;D:\file.w64&amp;quot;, SampleRate=6) # assumes the presence of a W64 header and reads the needed info from it&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;div id=&amp;quot;mpeg-aud&amp;quot;&amp;gt;How do I load MP1/MP2/MP3/MPA/AC3/DTS/LPCM into AviSynth?&amp;lt;/div&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Use NicAudio for loading your MP1/MP2/MPA/AC3/DTS/LPCM in AviSynth:&lt;br /&gt;
Use DirectShowSource() for MP3&lt;br /&gt;
&lt;br /&gt;
Some examples:&lt;br /&gt;
&lt;br /&gt;
 LoadPlugin(&amp;quot;C:\Program Files\AviSynth25\plugins\NicAudio.dll&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 # AC3 audio:&lt;br /&gt;
 V = BlankClip(height=576, width=720, fps=25)&lt;br /&gt;
 A = NicAC3Source(&amp;quot;D:\audio.AC3&amp;quot;)&lt;br /&gt;
 # A = NicAC3Source(&amp;quot;D:\audio.AC3&amp;quot;, channels=2) # downmix to stereo&lt;br /&gt;
 AudioDub(V, A)&lt;br /&gt;
&lt;br /&gt;
 # LPCM audio (48 kHz, 16 bit and stereo):&lt;br /&gt;
 V = BlankClip(height=576, width=720, fps=25)&lt;br /&gt;
 A = NicLPCMSource(&amp;quot;D:\audio.lpcm&amp;quot;, 48000, 16, 2)&lt;br /&gt;
 AudioDub(V, A)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;div id=&amp;quot;aud-other&amp;quot;&amp;gt;How do I load aac/flac/ogg files into AviSynth?&amp;lt;/div&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Use ffdshow (set AAC to libfaad or realaac), and use&lt;br /&gt;
&lt;br /&gt;
 DirectShowSource(&amp;quot;d:\audio.aac&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
For WAVE_FORMAT_EXTENSIBLE, ogg, flac, wma, and other formats, [http://forum.doom9.org/showthread.php?t=108254 BassAudio and the correspoding libraries and Add-Ons] can be used. Note that BassAudioSource can decode stereo aac/mp4, but it can&#039;t decode multichannel aac.&lt;br /&gt;
&lt;br /&gt;
Some examples:&lt;br /&gt;
&lt;br /&gt;
 bassAudioSource(&amp;quot;C:\ab\Dido\001 Here With Me.m4a&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 bassAudioSource(&amp;quot;C:\ab\Dido\001 Here With Me.aac&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;div id=&amp;quot;pics&amp;quot;&amp;gt;How do I load pictures into AviSynth?&amp;lt;/div&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
1) Use [[ImageReader]] or [[ImageSource]] to load your pictures into AviSynth (can load the most popular formats, except GIF and animated formats). See internal documentation for information.&lt;br /&gt;
&lt;br /&gt;
2) Use the Immaavs plugin for GIF, animated formats and other type of pictures.&lt;br /&gt;
&lt;br /&gt;
 # single picture:&lt;br /&gt;
 immareadpic(&amp;quot;x:\path\pic.bmp&amp;quot;)&lt;br /&gt;
  &lt;br /&gt;
 # animation:&lt;br /&gt;
 immareadanim(&amp;quot;x:\path\anim.gif&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 # image sequence:&lt;br /&gt;
 immareadseq(&amp;quot;x:\path\seq%3.3d.png&amp;quot;, start=5, stop=89, fps=25, textmode=2, posx=50, posy=50)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|[[AviSynth_FAQ | Main Page]] | [[FAQ_general_info | General Info]] | &#039;&#039;&#039;Loading clips&#039;&#039;&#039; | [[FAQ_frameserving | Loading Scripts]] | [[FAQ_common_errors | Common Error Messages]] | [[FAQ_different_types_content | Processing Different Content]] | [[FAQ_YV12 | Dealing with YV12]] | [[FAQ_using_virtualdub_plugins | Processing with Virtualdub Plugins]] |&lt;br /&gt;
&lt;br /&gt;
[[Category:AviSynth FAQ]]&lt;/div&gt;</summary>
		<author><name>ItaloFan</name></author>
	</entry>
	<entry>
		<id>http://www.avisynth.nl/index.php?title=AutoCrop&amp;diff=10767</id>
		<title>AutoCrop</title>
		<link rel="alternate" type="text/html" href="http://www.avisynth.nl/index.php?title=AutoCrop&amp;diff=10767"/>
		<updated>2019-08-29T22:24:02Z</updated>

		<summary type="html">&lt;p&gt;ItaloFan: spelling, grammar, punctuation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FilterCat4|External_filters|Plugins|Adjustment_filters|Borders and Cropping}}&lt;br /&gt;
{{Filter3&lt;br /&gt;
|[https://web.archive.org/web/20050404182221/http://www.videofringe.com/autocrop/ Glenn Bussell], len0x&lt;br /&gt;
|v1.2&lt;br /&gt;
|3=[http://len0x.leffe.dnsalias.com/autocrop12.zip autocrop12.zip]&lt;br /&gt;
|4=Borders and Cropping&lt;br /&gt;
|5=[https://www.gnu.org/licenses/gpl-2.0.txt GPLv2]&lt;br /&gt;
|6=[https://forum.doom9.org/showthread.php?t=37204 Doom9 Thread] - [https://forum.doom9.org/showthread.php?t=87602 Update]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
[[AutoCrop]] is an AviSynth filter that automatically crops the black borders from a clip. It operates in either preview mode where it overlays the recommended cropping information on&lt;br /&gt;
the existing clip, or cropping mode where it really crops the clip. It can also ensure width and height are multiples of specified numbers so the cropped clip can be passed to the video compressor of your choice without problems.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Requirements ==&lt;br /&gt;
* AviSynth 2.5.8 or [https://sourceforge.net/projects/avisynth2/ greater]&lt;br /&gt;
* Supported color formats: [[YUY2]], [[YV12]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== [[Script variables|Syntax and Parameters]] ==&lt;br /&gt;
AutoCrop takes 12 parameters, but they are all optional so you can just do &amp;lt;code&amp;gt;AutoCrop()&amp;lt;/code&amp;gt; to get a feel for how the filter works. Parameters can either be specified in order or by name. I suggest specifying by name, as there are a lot of parameters!&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:{{Template:FuncDef|AutoCrop (clip, int &amp;quot;mode&amp;quot;, int &amp;quot;wMultOf&amp;quot;, int &amp;quot;hMultOf&amp;quot;, int &amp;quot;leftAdd&amp;quot;, int &amp;quot;topAdd&amp;quot;, int &amp;quot;rightAdd&amp;quot;, int &amp;quot;bottomAdd&amp;quot;, int &amp;quot;threshold&amp;quot;, int &amp;quot;samples&amp;quot;, int &amp;quot;samplestartframe&amp;quot;, int &amp;quot;sampleendframe&amp;quot;, float &amp;quot;aspect&amp;quot;)}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2| |clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|mode|int|1}}&lt;br /&gt;
:::*0 : Crop - Crops the image&lt;br /&gt;
:::*1 : Preview - Suggested cropping information is overlayed on the existing clip, including a crop command that you can use to replace AutoCrop with.&lt;br /&gt;
:::*2 : Log - Logs the cropping parameters to the file &amp;quot;AutoCrop.log&amp;quot; in the current directory.&lt;br /&gt;
:::*3 : Crop &amp;amp; Log - combination of modes 0 and 2&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|wMultOf|int|4}}&lt;br /&gt;
::{{Par2|hMultOf|int|2}}&lt;br /&gt;
:::Ensures that the width of the cropped clip will be a multiple of the number specified. Use this to ensure that clip is a valid for whatever codec you are going to compress with. hMultOf is the same, but for the height.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|leftAdd|int|0}}&lt;br /&gt;
:::Forces autocrop to crop an additional &#039;leftAdd&#039; pixels after it completes auto detection. You can use this option in conjunction with wMultOf. Useful for cropping out bad quality lines on the side of VHS captures.&lt;br /&gt;
&lt;br /&gt;
::{{Par2|topAdd|int|0}}&lt;br /&gt;
:::Forces autocrop to crop an additional &#039;topAdd&#039; pixels after it completes auto detection. You can use this option in conjunction with hMultOf. Useful for cropping out bad quality lines on the top of VHS captures.&lt;br /&gt;
&lt;br /&gt;
::{{Par2|rightAdd|int|0}}&lt;br /&gt;
:::Same as leftAdd but for the right side.&lt;br /&gt;
&lt;br /&gt;
::{{Par2|bottomAdd|int|0}}&lt;br /&gt;
:::Same as topAdd but for the bottom side.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|threshold|int|40}}&lt;br /&gt;
:::Threshold is the average luminance a line must have before it&#039;s considered non blank. For DVD sources values as low as 20 should work reliably. For VHS sources raising the value may be necessary.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|sample|int|5}}&lt;br /&gt;
:::The number of frames to examine when determining the cropping information. This directly affects the startup time of the filter. This number dramatically effects the amount of time taken for the filter to startup. Increasing the number to 10 will basically double the startup time.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|samplestartframe|int|0}}&lt;br /&gt;
::{{Par2|sampleendframe|int|-1}}&lt;br /&gt;
:::These parameters set the first and last frame to be looked at when determining the cropping parameters. Defaults are the first frame(0) and last frame(-1).&lt;br /&gt;
:::If you want to take the cropping information from a single frame, set samplestartframe and sampleendframe to the same number and samples to be 1&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|aspect|int|0}}&lt;br /&gt;
:::*-1 : Maintain aspect ratio of the source clip&lt;br /&gt;
:::*0 : Aspect is ignored&lt;br /&gt;
:::*&amp;gt;0 : Aspect ratio will be set to this. For example for a 4:3 aspect ratio you would pass 4.0/3.0 or 1.33333333333. Note that 4/3 won&#039;t work since the .0 is needed to tell AviSynth the value is a float.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Examples ==&lt;br /&gt;
AutoCrop with default values:&lt;br /&gt;
 [[AviSource]](&amp;quot;Blah.avi&amp;quot;)&lt;br /&gt;
 AutoCrop(mode=1, wMultOf=4, hMultOf=2, leftAdd=0, topAdd=0, rightAdd=0, bottomAdd=0, \&lt;br /&gt;
          threshold=40, samples=5, samplestartframe=0, sampleendframe=-1, aspect=0)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Changelog ==&lt;br /&gt;
 Version       Date            Changes&amp;lt;br&amp;gt;&lt;br /&gt;
 v1.2          01/03/2005      - fixed bug when preview and actual crop values were different&lt;br /&gt;
                               - fixed bug when AR was not properly enforced (rounding errors)&lt;br /&gt;
                               - threshold 0 ensures that no cropping is done unless necessary for AR&lt;br /&gt;
                               - fixed bug when leftAdd and rightAdd parameters were not properly working in YUY2 mode&lt;br /&gt;
                               - wMulfOf and hMultOf cannot be zero now&lt;br /&gt;
                               - wMultOf is relaxed to be mod2 for YV12 (previously mod4)&lt;br /&gt;
                               - added mode=3 which is mode 0 plus mode 2 (cropping and logging at the same time)&amp;lt;br&amp;gt;&lt;br /&gt;
 v1.1          06/17/2003      - Added ability to set a range of frames to sample for cropping information.&lt;br /&gt;
                               - Reduced default number of frames to sample to 5.&lt;br /&gt;
                               - Reduced default threshold to 30, this change and the one above should perform give &lt;br /&gt;
                                 equal or better performance for DVD sources much quicker.&lt;br /&gt;
                               - Minor documentation updates.&amp;lt;br&amp;gt;&lt;br /&gt;
 v1.0          03/09/2003      - A new version of AutoCrop which solves the YV12 cropping problems found in version 0.51.&amp;lt;br&amp;gt;&lt;br /&gt;
 v0.51         27/02/2003      - New version 0.51 with (hopefully) working wMultOf and hMultOf in YV12 mode.&amp;lt;br&amp;gt;&lt;br /&gt;
 v0.5          26/02/2003      - This version (finally) adds YV12 support.&amp;lt;br&amp;gt;&lt;br /&gt;
 v0.4          01/30/2003      - This version of AutoCrop is compiled for AviSynth 2.5 it will not work with any of the 2.0 releases.&lt;br /&gt;
                               - The preview argument (which was a boolean) has been removed and replaced with the new mode argument &lt;br /&gt;
                                 (which is an int) this was to allow for the implementation of the logging mode and the future blanking mode.&lt;br /&gt;
                               - Aspect Ratio support. Support for maintaining and setting aspect ratios is included.&lt;br /&gt;
                               - Logging mode. Image is left untouched, cropping information is written to the file &amp;quot;AutoCrop.log&amp;quot; &lt;br /&gt;
                                 in the current directory.&amp;lt;br&amp;gt;&lt;br /&gt;
 v0.3          11/05/2005      - Setting wMultOf=width now behaves correctly. ie. Just letterboxes the clip.&lt;br /&gt;
                               - Debugging information no longer written to disk.&amp;lt;br&amp;gt;&lt;br /&gt;
 v0.1          11/03/2002      - Initial release for AviSynth 2.0 &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Archived Downloads ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;; width=&amp;quot;600px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!!width=&amp;quot;100px&amp;quot;| Version&lt;br /&gt;
!!width=&amp;quot;150px&amp;quot;| Download&lt;br /&gt;
!!width=&amp;quot;150px&amp;quot;| Mirror&lt;br /&gt;
|-&lt;br /&gt;
!v1.2&lt;br /&gt;
|[http://len0x.leffe.dnsalias.com/autocrop12.zip autocrop12.zip]&lt;br /&gt;
|[https://web.archive.org/web/20130311200834/http://len0x.leffe.dnsalias.com/autocrop12.zip autocrop12.zip]&lt;br /&gt;
|-&lt;br /&gt;
!v1.1&lt;br /&gt;
|[https://web.archive.org/web/20041204083940/http://www.avisynth.org/warpenterprises/files/autocrop_25_dll_20030617.zip autocrop_25_dll_20030617.zip]&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
!v1.0&lt;br /&gt;
|[https://web.archive.org/web/20031214011808/http://www.avisynth.org/warpenterprises/files/autocrop_25_dll_20030309.zip autocrop_25_dll_20030309.zip]&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
!v0.3&lt;br /&gt;
|[http://www.avisynth.nl/users/warpenterprises/files/autocrop_20_dll_20021105.zip autocrop_20_dll_20021105.zip]&lt;br /&gt;
|[https://web.archive.org/web/20031214011808/http://www.avisynth.org/warpenterprises/files/autocrop_20_dll_20021105.zip autocrop_20_dll_20021105.zip]&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== External Links ==&lt;br /&gt;
*[https://avisynth.org.ru/docs/english/externalfilters/autocrop.htm avisynth.org.ru] - AutoCrop documentation.&lt;br /&gt;
*[https://github.com/KG7x/xvid4psp/tree/master/AutoCrop GitHub] - AutoCrop mod by XviD4PSP. Original [https://code.google.com/archive/p/xvid4psp/ Google Code repository]. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----------------------------------------------&lt;br /&gt;
&#039;&#039;&#039;Back to [[External_filters#Borders_and_Cropping|External Filters]] &amp;amp;larr;&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>ItaloFan</name></author>
	</entry>
</feed>