The non-magic of Avisynth 2011 edition - Tutorial

Dec 01, 2011 05:19

My first tutorial on post-processing with Avisynth is almost four years old and while a lot of stuff still holds true, I think it is time for an update on some things.

Basically what I do is export my vid with a lossless codec, preferable Huffyuv v2.1.1, but Lagarith or any lossless codec is fine, too, from my editing program. I now can get my footage without any quality loss into AvsP. Here I play around with the script till I'm satisfied and then save it. In VirtualDub I open my script via Ctl-O or File -> Open video file -> select your filter script. Then either Ctl-P or Video -> Compression -> Select your lossless codec and then F7 or File -> Save as avi. Rename it, I usually add -filter. Depending on your processor, some of these scripts are under five minutes or up to an hour. You then can encode your AVI-result in the way you would for the web.

To sum shit up, AvsP and its preview function is your best friend. AMVapp has among many needed programs, already a bunch of useful avisynth plugins collected. If you want to add filters, you need to copy the files - mostly with the suffix .dll - in your plugins-folder in Avisynth or in 64plugins for the 64-bit ones. Some dlls you have to copy in either your System32 or SysWOW64. This is explicitly stated in the install instructions, for example libfftw3f-3.dll to make dither/dfttest work. I am in no way an expert on Avisynth, most things gathered here, are nothing more than a collection of filters and lines of codes I found useful, while surfing on doom9.

Enhancing your final encode with Avisynth really depends on your source. Season 1 of 'The X Files' will need a different treatment than say 'Game of Thrones' when it comes out on blu-ray next spring. This is important to know - There is no fix-it-all-script out there. You will need to adjust your scripts to your own source, what your final encode of your vid looks like and most importantly to your own liking. There are people out there who have the reconstruction of old movie/TV footage for their own collections down to an art, in such a sophisticated way that the ones putting out the 'remastered' DVDs should be ashamed. But this is not what I do here, I just want to make the final vid encode I get from Premiere more shiny or less dated looking, depending on the encode. I know that I have the hardest time finding a good balance with multiseason vids for TXF, AtS or BtVS, because cameras did become so much better over the shows run, sometimes even over the length of a season. Yes, I' looking at S2 of TXF.

Another thing to keep in mind with avisynth post-processing is that you often can add a similar effect with your editing program. But why would you adjust Brightness/Contrast for every single clip, if you want one overall effect for the video and you can have it with a single line of code? Sometimes you have to go back and adjust some levels for a few clips in your encode, because otherwise they would be too bright or washed out. Other effects you can't achieve with your editing program, because Avisynth was basically created to process shitty source and make it shinier for PC consumption. Denoisers are a perfect example for this. They reduce the websize and more importantly improve the image quality in ways the effects in your editing program can't.

So there are certain aspects you have to weight against each other when doing post-processing with Avisynth like how much detail are you willing to give up for higher contrast/a smoother image. Some filter adjustments will look awesome on a night shot, but will shot your daylight details to hell. Some make your S1 footage shine, but blur your S8. So always scrub through your preview-bar. Try to get a good idea, what your vid will look like after you processed it with this filter in VirtualDub, otherwise you might need to reencode and this might take up another half an hour or so.

Okay, let's start with a simple script, I tend to use a lot on Multifandom sources with Xandra. It gets you from a to b:

AVISource("D:\example.avi")
ConvertToYUY2 #Colorspace conversion for filters
Crop(8, 4, -8, -4) #Croping of residue DVD borders
LanczosResize(720,400) #Resizing to my weboutput
farbe2 = ImageReader("D:\...\ farboverlay001.jpg") #Color overlay definition
Overlay(farbe2, opacity=0.05, mode="softlight") #Color overlay
tweak(sat=1.15, bright=-5, cont=1.15) #Upping the Saturation, taking away some Brightness and adding Contrast
Levels(15, 1, 235, 0, 255, coring=false) #Adding Level contrast
MSharpen(strength=45) #Sharpening

Basically what this script does is narrow down your color range to some degree. It creates a more coherent overall colorscheme with less peaks and valleys for different sources. Adding the contrasts helps here. It's pretty plain force, but it gets the job done without overdoing it. I tend to add contrast and a bit of saturation to every encode, along with dfttest().

Another really basic script is this one to achieve more details:

AVISource("D:\angelswouldfall.avi")
ConvertToYUY2
LanczosResize(720,400)
dfttest(sigma=10)
tweak(sat=1.15, bright=-5, cont=1.25, coring=false)
ConvertToYV12
LSFmod(strength=120)
ConvertToYV12
Deen("w3d",2,4,4)
gradfun2db() #Debanding

I'm not entirely sure, if you need additional filters for this. Except of course gradfun2db() and LSFmod but I think most of them you'll get with a quick google search.

While vidding 'Metal Heart' I had to deal with source from 1993, so to get from a to b:

Video= AVISource("D:\metalheart.avi", false)
Audio= WAVSource("D:\my.wav")
AudioDub(Video,Audio)
ConvertToYUY2
Crop(8, 4, -8, -4)
LanczosResize(720,400)
tweak(sat=1.15, bright=3, cont=1.25, coring=false)
Levels(15, 1, 235, 0, 255, coring=false)
dfttest(sigma=50) #Denoiser
MSharpen(strength=85)
ConvertToYV12
water = ImageReader("D:\newsignature.jpg") #Signatur overlay definition
Overlay(water, opacity=0.3, mode="add")#Signatur overlay

Actually I tried out different denoisers in the original script and this is the basic version, that gets the same quality without adding an hour processing time in VirtualDub. Dfttest is awesome with denoising your source and avoiding the worst of color banding. I really recommend it, but usually not at this high setting.

I did use avisynth in the past to get an overall effect done to the final encode. For 'Take me home' I did wash out the source with the second line of code to a really harsh colorscheme. To see what I did click here. This was the script I used and what I liked about ColorYUV(autogain=true, autowhite=true) was the additional grittiness and that it felt less static.

AVISource("D:\takemehome.avi")
ConvertToYUY2
tweak(sat=0.2, hue=132)
farbe1 = ImageReader("D:\colorgradient.jpg")
Overlay(farbe1, opacity=0.2, mode="softlight")
ConvertToYUY2
clip1 = AVISource("D:\takemehome.avi")
Overlay(clip1, opacity=0.45, mode="add")
dfttest(sigma=1.0)
MSharpen(strength=45)
tweak(sat=1.5, bright=-20, cont=1.5)
temporalcleaner()
water = ImageReader("D:\newsignature.jpg")
Overlay(water, opacity=0.5, mode="lighten")
ColorYUV(autogain=true, autowhite=true)
Crop(6, 4, -6, -4)
LanczosResize(720,400)

In 'Clear the Area' I used a simple blue color texture to get to this result.

AVISource("D:\clearthearea.avi")
ConvertToYUY2
LanczosResize(720,400)
farbe1 = ImageReader("D:\blue.jpg")
Overlay(farbe1, opacity=0.4, mode="chroma")
dfttest()
tweak(sat=1.5, bright=6, cont=1.5)
temporalcleaner()
MSharpen(strength=45)
water = ImageReader("D:\newsignature.jpg")
Overlay(water, opacity=0.3, mode="add")

The cool thing about Avisynth is that you can basically achieve the same effect with endless filters or combinations thereof and also use all kinds of textures with the ImageReader and overlay function.

I'll try to answer all questions, if you have any - I promise.

Edited: This came up in a comment on my old tut, but it makes sense to link it from here, too. A nice filter collection and another good filter collection is stored here on the avisynth wiki and is therefore updated regulary.

tutorial, vid_stuff

Previous post Next post
Up