Jump to

Script Examples

Here are three Sample Scripts which you can Cut & Paste. The samples show how to IVTC (NTSC) and Field Match (PAL) using different types of sources.

AVISynth Script Sample #1:
Lets assume we have a single file MJPEG NTSC (29.97fps) source video, it has a 640x480 resolution and we want to IVTC, Crop and Resize it to 576x432. The image is also overscanned (video image doesn't cover the entire resolution, requiring us to crop). So for this example we'll assume there are 3 black lines on the Left, 5 at the Top, 2 on the Right and 1 at the Bottom. Every line beginning with "#" is a comment.

# Load our plugins, we load MJPEGcorrect plugin since our AVI is an MJPEG source.
LoadPlugin("x:\avisynth_plugs\decomb.dll")
LoadPlugin("x:\avisynth_plugs\MJPEGcorrect.dll")

# We only have one AVI file and it's not segmented so we use AVISource to load it:
AVISource("x:\my_video\sample01.avi")

# Source is MJPEG so we correct it's Luma Range:
MJPEGcorrect()

# We now Telecide the video to match all the fields and blend any interlacing that still remains:
Telecide(reverse=false, swap=false, firstlast=false, post=true, threshold=15, dthreshold=9, blend=true, chroma=false, y0=0, y1=0)

# We now Decimate 1 frame in 5 in order to restore the original 23.976 frame rate:
Decimate(cycle=5,mode=0,threshold=0)

# We now Crop the video to get rid of useless non-image data:
Crop(3,5,635,474)

# We now resize the final image to our desired resolution:
BicubicResize(576,432)



AVISynth Script Sample #2:
Lets assume we have a 3 file segmented HUFFYUV source (which was specifically encoded in YUV format, you must make sure your Capture Card is set to a YUV format such as YUY2, otherwise it will encode in RGB, which isn't what we want). The file names are "sample02.00.avi", "sample02.01.avi" and "sample02.02.avi".

Our source is NTSC format 640x480 with overscan at 0 pixels on the left, 0 pixels on the top, 2 pixels on the right and 4 pixels on the bottom. We want to IVTC, Crop and Resize it to 608x456 (it's always important to make sure that the end resolution width divides smoothly by 32).

# Load your plugins. DON'T load MJPEGcorrect plugin since our AVI is an HUFFYUV source.
LoadPlugin("x:\avisynth_plugs\decomb.dll")

# Load your video source. This is a 3 file segmented source so we use:
SegmentedAVISource("x:\my_video\sample02.avi")

# Now Telecide the video to match all the fields and blend any interlacing that still remains:
Telecide(reverse=false, swap=false, firstlast=false, post=true, threshold=15, dthreshold=9, blend=true, chroma=false, y0=0, y1=0)

# Decimate 1 frame in 5 in order to restore the original 23.976 frame rate:
Decimate(cycle=5,mode=0,threshold=0)

# Crop the video to get rid of useless non-image data:
Crop(0,0,638,476)

# Now resize the final image to our desired resolution:
BicubicResize(608,456)



AVISynth Script Sample #3:
Lets assume we have a 4 file segmented MJPEG source. The file names are "sample03.00.avi", "sample03.01.avi", "sample03.03.avi", "sample03.04.avi".

Our source is PAL format 768x576 with overscan at 4 pixels on the left, 0 pixels on the top, 0 pixels on the right and 0 pixels at the bottom. We want to Field Match, Crop and Resize it to 704x528. We also have subtitles that might interfere with out field matching. The Subtitles start on line 450 and end on line 510.

# Load your plugins. We load MJPEGcorrect plugin since our AVI is an MJPEG source.
LoadPlugin("x:\avisynth_plugs\decomb.dll")
LoadPlugin("x:\avisynth_plugs\MJPEGcorrect.dll")

# Load your video source. This is a 4 file segmented source so we use:
SegmentedAVISource("x:\my_video\sample03.avi")

# Source is MJPEG so correct it's Luma Range:
MJPEGcorrect()

# Now Telecide the video to match all the fields and blend any interlacing that's still remains while ignoring the subtitle area:
Telecide(reverse=false, swap=false, firstlast=false, post=true, threshold=15, dthreshold=9, blend=true, chroma=false, y0=450, y1=510)

# We don't decimate at all since this is a PAL source video and PAL is always 25fps:

# Crop the video to get rid of useless non-image data:
Crop(4,0,764,576)

# Now resize the final image to your desired resolution:
BicubicResize(704,528)





PREVIOUS NEXT