19. Using AVISynth Files for Footage
Moderator: Niotex
- Guides
- Joined: Fri Oct 13, 2023 7:03 pm
Using the Avisynth File for Footage
At this point you should have a working AVIsynth file that contains your video footage. You'll need to decide what to do with it in terms of editing.
1) Create avi files to edit with (Recommended)
This method involves either making clips or encoding entire episodes/movies with a lossless codec. The resulting Avi files are fast and easy to work with, and this is the method that I use and recommend. The major downside of this method is the amount of space that the losslessly encoded Avi files will take up. If you plan to encode entire episodes or movies, you will need a LOT of space. Estimate about 5gb per 25 minute episode.
Making clips can be useful for those who find it unwieldy to edit with full episodes and full dvds. It can also give you a good pool of footage to work from and saves searching around for footage. Making clips can also significantly help with the disk space problems. Instead of saving entire episodes, you may only need about 5 minutes of footage from a certain episode, and 1 minute of footage from another episode, and so on. Depending on how many clips you make and how long they are, it is quite possible to fit all of the footage that you will need into only a few gigabytes of space.
This is a tried and tested method and works well in pretty much any program you care to consider.
2) Edit directly with the AviSynth files.
This method is mainly used to be recommended if you are working with Adobe Premiere, since you can import your AviSynth files directly into it (via the plugin included in the AMVApp). However as of Premiere Pro CS5, the plugin no longer works! This method is usable with other programs as well, but you will have to go through an extra step, which can complicate things a little further.
The main benefit of this method is that it allows you to have access to entire episodes without using the huge amounts of disk space that are required by method 1. This flexibility comes at a cost though--AviSynth files will be slower than the clips you will have in method 1. The more filters you apply to your scripts (IVTC and deinterlacing included), the slower they will run. If you have a fairly fast computer this isn't a bad method, and is definately worth consideration.
Another downside of using this method is that it is considerably less stable than method 1, and can use SIGNIFICANT amounts of memory, if you are editing multiple avs scripts.
3) Proxy Files (the "bait-and-switch" method).
First off, this technique may not work all that well with some editing programs. Even if this works alright in your editing program, I still don't recommend it because there is a lot of potential to simply screw things up after you have finished editing your video. A few years ago when hard drives were small and processors were slow, this was a viable option for those who simply couldn't work with methods 1 or 2. In this day and age though, this method has simply lost many of its advantages.
The basic idea behind this method is to create small and low-quality avi files which will be fast to edit with. After you have finished editing your video with these low-quality files, you can swap them out with the full-quality avisynth files and then export your video. On paper, this would appear to give you the best of both worlds--fast files for editing without using a lot of disk space--but in reality this method can be somewhat finicky and difficult to work with.
If you take the time to make sure that this will work perfectly before you begin editing your video, then I suppose it's an alright method, particularly if you are still working from old hardware.
OK, so do you know which method you want to use?
Method 1: Create Avi Clips
Method 2: Edit directly with avs files
Method 3: Bait and Switch the avs files with low quality avi files
- Guides
- Joined: Fri Oct 13, 2023 7:03 pm
Method 1: Creating Clips for Source Footage
Before I actually get onto the conversion details I would like to emphasis a few things:
DO NOT USE DIVX OR XVID or any divx variant. They are very difficult to edit with and the quality, no matter how good it looks to you when you are editing, will make things look worse than if you used a lossless compression codec. MPEG4 codecs may well be small but they are not good things to edit with.
DO NOT USE MPEG1 - lots of people like using mpeg1 for editing. However, even in Premiere and other programs that have mpeg1 support, the editing will not be frame accurate and you may find that the cut you thought was spot-on actually pops into the next scene when editing. This is very bad, not to mention that the quality will be pretty aweful when it's all done too.
Preparing the Clips
If you have followed the guide so far you should have an avisynth script that
- Imports Footage
- Removes Interlacing (makes the footage progressive)
- Corrects any Aspect Ratio issues
- Is generally nice, clean and looking good
Compressing with UtVideo
There is one codec which I highly recommend that you use, and that is the UtVideo codec. This codec is VERY fast, and compresses the files quite small (relatively speaking, of course).
Open up VirtualDub and load your avs script into it, and in the menus go to Video -> Compressor and in the list choose Ut Video Codec YUV420. You will probably see 4 different versions of the Ut Video codec, so be sure to choose the "420" one. This one encodes to YV12 colorspace, which will have a smaller filesize than the others. The options are very simple: The frame divide setting should be set to the number of cores that your CPU can handle. If you don't understand this setting, the default should be ok. The other setting is a choice between better compression, or faster speed. I personally go with better compression, so my files will be smaller.
Once you have the compressor selected you must make sure that you select Video -> Fast Recompress which will ensure that there will be no colorspace conversions between your input to your output.
Making the Clips
Once you've got the codec and the compression method set up, you can search through your source using the bar at the bottom and then use the two rightmost buttons (Mark In and Mark Out) to select the area you want to convert into a clip. After you have chosen the range, simply go into the File menu and choose "Save as avi..."
Now if you like, you can simply save an entire episode or movie, rather than cutting clips out from it. This is in fact what I do. But, just make sure you have plenty of free space available, because it will probably use about 6-8gb per episode.
Now you may be interested in using VirtualDub's Job Control to encode several clips at once in a batch, rather than doing them one at a time. Instead of doing "File > Save as Avi...", instead do "File > Queue as Batch Operation > Save as Avi...", or simply press Ctrl+Shift+F7. Once you have added all of your jobs to the queue, you can bring up the Job Control menu by going to "File > Job Control". From there, you will see all of the jobs listed, and you can encode them all by pressing the "Start" button.
Now that you're done, you should have a look at how to set up a project in your video editing application.
September 2010
- Guides
- Joined: Fri Oct 13, 2023 7:03 pm
Method 2: Editing DVD footage directly.
You have avs files which decode and filter DVD footage all ready for editing... but there's a problem.
Many video editing applications do not like .avs files by default. Some programs require plugins and other programs have to use what is known as an 'avi wrapper' to make the programs read the avs files. Which method will depend greatly on your editing program.
a) Adobe Premiere - Premiere can use .avs files directly thanks to an import plugin which is included in the AMVapp.
b) Programs with no other .avs support - In order to use .avs files in programs like Windows Movie Maker, Vegas Video, Adobe After Effects, Ulead Movie Studio Pro and so on, you need to use the AviSynth Virtual File System.
But, let me make one thing clear. This method is NOT recommended. Making lossless clips is far more stable, and editing will be faster. This method uses lots of ram if you are using several different scripts at once, so coupled with the fact that most video editing software uses lots of ram anyways, this can start to get bogged down very fast.
Adobe Premiere
To edit with your avisynth files in Premiere, you will need to download the latest Premiere Import Plugin. If you have downloaded and installed the AMVapp then you should already have it installed. One you have this installed, it will allow you to open AVISynth (.avs) files in Premiere. Note that as of Premiere Pro CS5, this plugin NO LONGER WORKS.
Quality, Stability and the Premiere AVS GUI
The Premiere plugin, developed by fellow amv-ers, contains a GUI which can change the quality of the footage you import into Premiere and it can also set up memory options to make AVS useage more stable.
When Premiere asks for a frame which is a different size than your source (preview window, timeline or exporting at a different size) the avs import plugin has to resize it. To do this there are 4 different resizers that you can choose in the GUI:
As you can tell by the descriptions, low-quality resizers are fast and high quality resizers are slow. So what I recommend is setting the algorithm to Nearest Neighbour as this will ensure the timeline thumbnails and monitor previews will be the fastest they can be. When you export, however, you will want to change this to one of the other settings as Nearest Neighbour is poor quality.
The slowdown with the better resizers isn't that much though. With a quick 1000 frame rendering test it took 31 seconds with Nearest Neighbour, 34 seconds with bilinear, 36 seconds with Bicubic and 37 seconds with lanczos3. So, if you don't mind that amount of increase then you can keep it high quality all the time.
The right hand section of the GUI changes the Set Memory Max preferences in avisynth. Avisynth is not usually designed to process multiple avs scripts at once and as a result the memory can get used up really fast when processing multiple scripts. This can lead to avisynth crashing halfway through a render. To avoid this you can set the maximum memory allowed by each script. This option currently only works with Avisynth 2.5+ (which comes with the amvapp). The default setting is 256mb but if you are using lots of scripts you may want to reduce this to avoid memory crashes. It's a tricky thing to set, however, as some scripts which have a lot of processing may need a lot of memory and could crash if you set it too low - don't go below 32mb unless you really have to.
Errors, bugs, limitations and other things to avoid
Using avisynth scripts in Premiere can be a delicate matter. There are a number of things you should be aware of when importing avs scripts into Premiere:
1) Check that the script works in VirtualDub. If you open a faulty script in Premiere you will just get a small 10 second clip containing an error message.
2) Make sure your avs script is creating an RGB32 output By adding ConvertToRGB32() to the end of your script, you can make sure that the footage is in the correct format for processing in Premiere.
3) Don't slow down clips too much. If you slow down clips in Premiere to very slow speeds (like <10%) then it might crash avisynth when you try to export or reload your project. Do not do this. Either make a still and use that or if it crashes when applying lots of filters, try and pre-render the section with a lossless codec.
4) Do not change your script whilst Premiere is open. It probably won't crash but if Premiere is expecting a 1000 frame file and you change something and give it a 30 frame file then any clips that no longer exist in the new avs file will be converted to 1 frame empty clips. Also, if you change the frame rate Premiere will have to interpolate the cuts and this can be really inaccurate leaving you with clips from all the wrong parts of your source footage.
5) Look out for avisynth crashes. If avisynth crashes it produces a short error clip instead of the footage. This is bad because it means the frames that were once there are no longer there. Premiere will sometimes, seeing that the frames are not there, convert your timeline edits to 1 frame completely destroying your project. The trick to avoid this is to NOT SAVE if you see this happen. Close down premiere, check your avisynth scripts to see if they are working, check your memory max settings and try the project again. If it's been saved with 1 frame cuts then you will have to go back to an older save file to restore your project. This is why setting up a Project Archive is important - you can see how to do that in the section on setting up your Premiere Project.
Now that you've read the info and understand the issues it's time to see how to correctly set up your video project.
Frameserving Avisynth to Programs without .avs Support
This method uses what is known as an avi wrapper. Many programs, when you give them a file, expect it to have a header that they recognise just like an avi header or an mpeg header. AVS files, however, are just text files so they do not have the information many programs need.
There is a way around this though, using the AviSynth Virtual File System (included in AMVApp).
Before you start, you want to make sure all of your avisynth scripts are in RGB32 colorspace, because this is the colorspace that your editing program will probably be expecting. This should be the final line of your avisynth script:
ConvertToRGB32()
Now, assuming the AviSynth Virtual File System is installed correctly, when you right click on an AviSynth script, you should see two new items in the menu: Quick Mount, and Mount. Choose the quick mount option, and now your AviSynth script should turn into a folder. If you open up this folder then you should see your original avisynth script along with an AVI file. The AVI file will probably report a very large filesize, but this file does not actually take up any space on your disk, because it is a "fake" AVI file. That is, it is simply a virtual file which will allow your editing program to access the AVS script. Now if your AVS script contains any errors, then you wont see an AVI file here--it can't generate anything if your script is incorrect! If that is the case, then you need to right click on this folder and choose "unmount", then correct your avisynth script and try again.
Once you are done with that, you can import these fake avi files directly into any program which supports AVIs, and it will think that it is looking at a standard uncompressed AVI file.
This method for using Avisynth scripts should work as well as the Premiere method but it has not been tested as thoroughly, so proceed with caution. Like with Premiere there are certain things you need to be careful about when dealing with avisynth footage.
1) Check that the script works in VirtualDub or AvsP. If you open a faulty script you will just get a small 10 second clip containing an error message so you should test all scripts beforehand.
2) Make sure your avs script is creating an RGB32 output. Most editing programs process natively in RGB and it is best to give them footage in this format so you know that what you put in is what you will get out. You can do this by adding ConvertToRGB32() at the end of your script.
3) Don't slow down clips too much. Avisynth has been known to crash in Premiere when you do this so it is also likely in other programs too. Either make a still and use that or if it crashes when applying lots of filters, try and pre-render the section with a lossless codec.
4) Do not unmount your files or try to change your script while your editing program is open. This can only cause bad things to happen.
5) Look out for avisynth crashes. Avisynth has a tendancy to crash if a) the script has a bad filter chain or b) there are memory buffer issues. The former should be spotted in VirtualDub, and once the script works it should be left alone. The latter can be fixed by editing the "setmemorymax.avsi" file contained in your Avisynth 2.5/Plugins folder. The amvapp includes this script and sets the default to 64mb which means 64mb of memory is allowed per script used. You can reduce this as you please to avoid memory issues but don't make it too low.
Now you have your fake avi files ready, you can set up your video project.
- Guides
- Joined: Fri Oct 13, 2023 7:03 pm
Method 3: Faster Editing with Proxy Files
Before we start, I just want to say that this method is very unstable. If you don't take the precautions mentioned here, you can end up losing all of your work. If you are using this method because you don't have enough disk space for method #1, I strongly suggest that you simply buy a larger hard drive. Hard drives with hundreds of gigabytes of free space are very cheap these days.
For this method, basically, you take every AVS file you want to use and make an ugly-but-quick AVI export of each one. It is frame for frame identical to the avs except the avi is much lower quality. Then you should edit with these low quality versions and when you are done you can switch back to the avs files which means in the end you have DVD quality footage but have used quick footage for easy editing.
The Method
You will already have avisynth files ready for all the footage you want to use if you have followed the guide. Now you need to get a codec that is good for editing. This means NO divx, NO mpeg-1, NO cinepak etc. The codec I recommend is the Lagarith Lossless codec as all the frames are keyframes, it's very fast, and has a reduced resolution mode which makes the filesizes ok.
Open up VirtualDub - this is the program we will use for creating the avi files. In the Video > Compression... menu choose Lagarith. Now click "Configuration".
In the Mode drop down box, select "Reduced Resolution". Then ensure that "Enable Null frames" is not checked, and do check "Always Suggest RGB Format for Output". If you have a multi-core processor, then you should check "Use Multithreading".
Now choose Fast Recompress from the VritualDub's Video menu and save to an AVI that is named similar to your avs file (so you know which AVI goes with which AVS). Your frame rate has to be the same as your avs file. I wouldn't change the resolution either as this will effect how things like motion settings will work when you edit.
Save your avi versions.
Note: Your low quality files obviously don't look anything near as good as the original, so if you are doing any effects such as masking, then you will have to switch to the avs version until you have them set up. You will also have to do that if you need to get stills from the source as well.
Switching Back to the DVD quality AVS Files in your editing program
You should test this out at the very start to avoid problems down the road. First of all, you need to set up your avs files so they can be loaded into your editing program, as described in method 2.
Now, Some software such as Premiere or After Effects has a function which can let you swap files with different ones. In that case, you simply need to use that feature. Because all editing software is different, you need to consult your software's manual in order to find out how to do this.
If your software DOESN'T have a feature like this, then you can usually trick it into switching the files by first making your your editing program is closed, and then move your low quality avi files to a different location on your hard drive. Then take your fake avi files (which are described in method 2), and put them where the low quality avi files originally were, and rename them so they have the same filenames that the low quality avis originally had. Now, when you open your editing software again, it should hopefully load the high quality avisynth scripts, instead of the low quality avi files. As you can see, this method sounds very risky, which is why I do not recommend it!
Now that you're done, you should go to the section on setting up your video project.