The Basics of Avisynth - Tutorial

Oct 03, 2011 11:54

There are still people out there, who are very intimidated by avisynth and how to use it to prepare their sources. So I compiled example scripts and tried to break the necessary steps down into easy to follow instructions. Everything is better and more detailed explained in this part of the A&E's guide - The 'A&E's technical guide to All Things Audio and Video' contains a lot of information and is maybe overwhelming, if you just start out with Avisynth and don't feel so confident. But you should follow it step for step while installing the software you need, which is compiled here in AMVapp.

If you followed these instructions you have among other things Avisynth installed and DGIndex. I assume I won't need to explain ripping, once that is done open DGIndex and then make sure you have Audio -> Output Method -> Disable and Video -> Field Operation -> Honor Pulldown Flags selected.

Press F2, select the ripped vobs. I always select the whole DVD, click open then press OK. Edited: You can also select all your vob-files (from one season or an entire show run) in this step. This way is more time efficient, because to index a whole 22-ep season you will need 20 minutes and don't need to repeat this step for every disc. And you will end with only one index file for the whole season, instead of five or six. Also making subclips in Premiere is a great way to organize your footage to your liking.

Now you see a timeline on the button of your screen, go into the middle of a ep and press F6. A windows pops up with all kinds of information, press ESC and take a closer look at the window. Aspect ratio, frame rate, frame type and field order are listed there and are the important ones. I make a index subfolder in the shows folder and save all .d2v files there, because otherwise it might get confusing, if you have several DVDs and seasons. Now press F4 - rename the file to your liking forexampleS1D1 and press okay.

It is possible that when DGIndex is finished indexing that a error message pops up telling you that a field order transition was detected. Say yes to the correction. Now it tells you that the original was saved with the extension .bad, press okay and close the editor file. You should have two files, one d2v and one avs. (If for some reason there wasn't an avs-file autocreated, just drag your d2v into AvsPmod and viola, that file would be automatically an avs-file when saved.) Okay, next DVD same game, F2 - delete the old files and add the new ones. then press okay. F4 and rename it to your liking and I think you get the idea. If you move your vob-files later onto another hard drive or folder, you must reindex. (There is a trick to avoid this reindexing, if you open the d2v-file with notepad and the use ctl-h and replace the hard drive-letter.)

Now you should have installed another program AvsPmod - it is a tool that helps you edit Avisynth files and has an awesome preview function. If you open the avs-file that DGIndex created with this program and press F5 you have a preview. You will get something like this and I added the second line to get rid of deinterlacing.

mpeg2source("X:\AtS\Index\AtS1x01-1x04.d2v", cpu=6)
LeakKernelDeint(order=1) # Fast Deinterlacer

So this is good enough to import into Premiere, but it might not be the way you prefer your footage. For example I like to have a whole season in one file and that is the beauty of Avisynth, it lets you do all kinds of stuff to your footage with just one line of code. Isn't that impressive and neat? All you need is the ++ between the files and they become one file you can use to edit in Premiere.

mpeg2source("X:\AtS\Index\AtS5x01-5x04.d2v", cpu=6) ++ mpeg2source("X:\AtS\Index\AtS5x05-5x08.d2v", cpu=6) ++ mpeg2source("X:\AtS\Index\AtS5x09-5x11.d2v", cpu=6) ++ mpeg2source("X:\AtS\Index\AtS5x12-5x15.d2v", cpu=6) ++ mpeg2source("X:\AtS\Index\AtS5x16-5x19.d2v", cpu=6) ++ mpeg2source("X:\AtS\Index\AtS5x20-5x22.d2v", cpu=6) # Full season

Now I have footage that has a few problems, I like to fix. First it is interlaced in PAL, then it is 4:3 and I don't want that, so I'll crop the frame to 16:9 with the focus slightly up in the frame, because it looks better that way for me and then resize it to PAL.

mpeg2source("X:\AtS\Index\AtS1x01-1x04.d2v", cpu=6) ++ mpeg2source("X:\AtS\Index\AtS1x05-1x08.d2v", cpu=6) ++ mpeg2source("X:\AtS\Index\AtS1x09-1x11.d2v", cpu=6) ++ mpeg2source("X:\AtS\Index\AtS1x12-1x15.d2v", cpu=6) ++ mpeg2source("X:\AtS\Index\AtS1x16-1x19.d2v", cpu=6) ++ mpeg2source("X:\AtS\Index\AtS1x20-1x22.d2v", cpu=6) # Full season
Telecide(order=1,guide=2) # PAL-Deinterlacing
Crop(8,40,-8,-104) # Cropping the footage to 16:9
LanczosResize(720,576) # Resize it to PAL-resolution

Edited 2012/08/26: This is my current way of doing this:

mpeg2source("X:\TXF Rip\Index\newTXFS3.d2v", cpu=6) #If you selected all vobs into one DGIndex file
TDeint(order=1, field=-1) #Another good Deinterlacer
Crop(10, 0, -8, -0) #Getting rid off black borders
LanczosResize(720,576) #Resize to the original 4:3 size

As you can see, I used Eunice's way to combine the season ahead in DGIndex. TDeint is a great Deinterlacer, it gives good results and is very fast. I also stopped doing the letterboxing in the script and now prefer to adjust the 4:3 clips in Premiere, because it gives me more control and room to play around in Premiere. If your project is set up with 720, 400, it will cut off the top and bottom of your clips, but you can adjust it easily to your liking with Motion. I now use the true aspect ratio in Premiere. For the first example this would be LanczosResize(720,400).

Okay, but what about downloaded eps? There are several clip attributes that play pretty much every format available. Ususally if you drag a video file into AvsPmod it gives it the clip attribute that is predefined. I prefer FFmpegSource2 for my footage, because it doesn't mesh up my mkvs and again it indexes the video files when they are first loaded for example for the preview and this index gives you frame accuracy. Just dump the contents of the downloaded file into your Avisynth plugin folder and it should work. To load this script for the first time you should be ready to wait a few minutes, while the vidfiles get indexed.

FFmpegSource2("X:\...\exampleshow1x01.mpg") ++ FFmpegSource2("X:\...\exampleshow1x02.mpg") ++ FFmpegSource2("X:\...\exampleshow1x03.mpg") ++ FFmpegSource2("X:\...\exampleshow1x04.mpg") # Full season
LanczosResize(720,400) # Resize if neccesary
AssumeFPS(25) # PAL framerate, only neccesary if you use dl eps and dvd rips in one vid, otherwise use the original framerate for your Premiere project
ConvertToRGB32() # Colorspace for Premiere, again optional

The cool thing about avisynth is the ability to combine files, if they have the same resolution and framerate. If not you'll get an error message. About the colorspace conversion, RGB32 is the colorspace Premiere handles best and so adding it can avoid later problems. You can see your colorspace among other things in AvsP in the left button corner. I made a screencap with a red circle here.

AVISource ("X:\...\exampleshow1x01.avi", "X:\...\exampleshow1x02.avi", "X:\...\exampleshow1x03.avi", "X:\...\exampleshow1x04.avi", false) # Full season - the false at the end kills the audio
LanczosResize(720,400) # Resize it if neccesary
AssumeFPS(25) # PAL framerate if neccesary
ConvertToRGB32() # Colorspace for Premiere

After anoel asked, I looked a bit into the the avi-file issue, because I rarely have them as source, I prefer mkvs. But I come down on the AVISource side of the clip attribute side of the fence. It is frame accurate and fast, I tried this with a project file and it might be easier to handle for Premiere.

FFmpegSource2("X:\...\exampleshow1x01.mkv") ++ FFmpegSource2("X:\...\exampleshow1x02.mkv") ++ FFmpegSource2("X:\...\exampleshow1x03.mkv") ++ FFmpegSource2("X:\...\exampleshow1x04.mkv") # Full season
LanczosResize(720,400) # Resize it, if high 720 or 1080 are too much to handle for your machine
ConvertToRGB32() # Colorspace for Premiere

Again I'm not an expert and these are basically the way I set my footage up. But I might be able to answer some question.

Edited on 11/11/29 to add some more information.
Edited on 12/08/26 to add the changes to my current scripts

tutorial, vid_stuff

Previous post Next post
Up