AVSEdit - AviSynth for the scripting impaired

Working with interlaced video

Depending on what filters your script uses, it may be necessary to separate the top and bottom fields from interlaced video before processing. Filters that compare pixels to adjacent pixels in the same frame (primarilly resize filters and spatial smoothers) won't work correctly if the video is interlaced. There are several ways to separate the top and bottom fields of the video, but the one I prefer is to use functions that are available on the AviSynth website in the Shared Functions section. You can copy and paste the functions into every script you want to use or you can do what I do and create a .AVSI (AviSynth Include) file so they will be available in AVSEdit. Follow these instructions to create the AVSI file:

Copy the following into a blank script:

#Functions For Processing Interlaced Video
#By stickboy (James D. Lin)#
# SetParity
function SetParity(clip c, bool parity)
return parity ? c.AssumeTFF() : c.AssumeBFF()
# UnfoldFieldsVertical
function UnfoldFieldsVertical(clip c, bool "flip")
flip = default(flip, false)
oldParity = c.GetParity()
c = c.AssumeTFF().SeparateFields().AssumeFrameBased()
top = c.SelectEven()
bottom = c.SelectOdd()
c = StackVertical(top, flip ? bottom.FlipVertical()
\ : bottom)
return c.SetParity(oldParity)
# FoldFieldsVertical
function FoldFieldsVertical(clip c, bool "flip")
assert(c.Height() % 2 == 0, "FoldFieldsVertical: unexpected frame height")
flip = default(flip, false)
oldParity = c.GetParity()
originalHeight = c.Height() / 2
evens = c.Crop(0, 0, c.Width(), originalHeight)
odds = c.Crop(0, originalHeight, c.Width(), originalHeight)
odds = flip ? odds.FlipVertical() : odds
c = Interleave(evens, odds).AssumeFieldBased().AssumeTFF().Weave()
return c.SetParity(oldParity)
#Stop Copying Here

Select Save As from the File menu and browse to the AviSynth plugins folder. Name the file 'Interlaced Functions.avsi (make sure you enter the .avsi extension). Close AVSEdit and then open it again and go to the Filters Tab. You have a new category called User. Expand that category and you'll see the 3 functions in the file you just saved - FoldFieldsVertical, SetParity, and UnfoldFieldsVertical. Now you can add these functions by double clicking them. When you have interlaced material that you want to denoise or resize, start by adding the UnfoldFieldsVertical function. If you highlight it in the editor, you'll see parameters listed. Ignore these parameters as they won't give you the correct syntax for the function. Instead, manually edit the line in the editor to read UnfoldFieldsVertical(true). When you are done filtering you need to weave the fields together again using FoldFieldsVertical(true).
Note: Some filters, like Crop and AddBorders, should be used while the video is still interlaced.

Using profiles

There are times when you want to try using different filters or even the same filter with different settings to find out which settings you prefer. By saving different versions as profiles, AVSEdit allows you to quickly switch between them without rewriting each time. To create a profile, go to the Profiles tab, enter a name in the field at the top, and click the save button. To load a profile, select the profile name from the list and click Load. If you want to compare scripts side by side you should use an external program for previewing (I use VirtualDubMod). Before you can do that you need to select Options from the Extras menu, click the External Preview button, and browse to the program you want to preview with. To compare different scripts, select External Preview from the Extras menu to view the output from the first script. Leave the external preview open, go back to AVSEdit, switch to another profile, and do another External Preview. Now you have both scripts open in different windows.
Note: I use profiles for editing TV captures. I have one profile with sound and one without. I do an External Preview in VirtualDubMod to save the audio stream as a WAV file (edited to match my video) and then use the profile with no sound to encode the video.

Table of Contents

  1. Introduction
  2. Plugins and familiarization
  3. Your first script
  4. Loading DVD2AVI Projects
  5. Editing
  6. Working with interlaced video
  7. Inverse Telecine
  8. Deinterlacing
  9. Getting more help
Advertisement - News comments available below the ad

© 2020 AfterDawn Oy

Hosted by
Powered by UpCloud