DVD Sources
All DVDs follow NTSC standards, however the visual quality is heavily dependent on the original source the disc was mastered from. DVDs can be authored from three different types of sources; analog videotapes, film, and digital media. Different filters will be required to clean the different video types, but most sources will also need cropped to remove any blank space from the edges. The order for the crop function variables in AviSynth is left, top, right, bottom; the right and bottom variables require negative values. In VapourSynth the order of the crop function variables is left, right, top, bottom; none of the variables will be negative.
(NOTE: Some quality issues in the sample images may not be as noticeable on small screens, viewing the sample images on a large screen is recommended.)
(IMPORTANT: Make sure to refer to an aspect ratio calculator when cropping to avoid distortion. The default color space for DVDs will require cropping by multiples of 2.)
A. Videotape Source
Analog videotape sources are typical for older DVDs and tend to have lower visual quality than other sources. The typical defects include crushed blacks, dot crawl, and rainbowing. TComb & Bifrost are recommended to repair dot crawl and rainbowing, but unfortunately crushed blacks cannot be fixed. Below is an example of these visual defects and representative AviSynth script for cleaning them up.
AviSynth Script Example
#Input video
MPEG2Source("DVD.d2v")
#Remove dot-crawl artifacts
Tcomb(mode=2)
#Remove rainbowing
Bifrost(interlaced=true)
#Restores progressive frames
tfm()
#Restores framerate to 23.976fps by removing duplicate frames
tdecimate(mode=1)
#Crops all sides to remove blank space yet maintain the aspect ratio
Crop(8,4,-6,-4)
#Changes the video to Fullscreen (4:3 Aspect Ratio)
Spline36Resize(640,480)
VapourSynth Script Example
#Import VapourSynth Core
import vapoursynth as vs
core = vs.get_core()
#Import Script for Anti-Aliasing Functions
import havsfunc as haf
#Import Video
video = core.d2v.Source(r’DVD.d2v’)
#Remove dot-crawl artifacts
video = core.tcomb.TComb(video, mode=2)
#Remove rainbowing
video = core.bifrost.Bifrost(video, interlaced=True)
#Restores Progressive Frames
video = core.vivtc.VFM(video, cthresh=10)
#Restores framerate to 23.976fps by removing duplicate frames
video = core.vivtc.VDecimate(video, mode=1)
#Crops all sides to remove blank space yet maintain the aspect ratio
video = core.std.CropRel(video, 8,6,4,4)
#Changes the video to Fullscreen (4:3 Aspect Ratio)
video = video.resize.Spline36(640,480)
#Sets Video Output
video.set_output()
Many older DVDs have poor encoding and more artifacts that to filter out. One good filter pairing is FFT3DFilter to smooth out the image and Hysteria to resharpen edges and lines. Below is an example of these additional filters.
AviSynth Script Example
#Input video
MPEG2Source("DVD.d2v")
#Remove dot-crawl artifacts
Tcomb(mode=2)
#Remove rainbowing
Bifrost(interlaced=true)
#Restores progressive frames
tfm()
#Restores framerate to 23.976fps by removing duplicate frames
tdecimate(mode=1)
#Removes film grain and smooths the image
strength = 2
FFT3DFilter(bw=6, bh=6, ow=3, oh=3, plane=0, bt=1, sigma=strength)
FFT3DFilter(bw=216, bh=216, ow=108, oh=108, plane=0, bt=1, sigma=strength/8, sigma2=strength/4, sigma3=strength/2, sigma4=strength)
#Sharpens lines and edges
Hysteria(video)
#Crops all sides to remove blank space yet maintain the aspect ratio
Crop(8,4,-6,-4)
#Changes the video to Fullscreen (4:3 Aspect Ratio)
Spline36Resize(640,480)
VapourSynth Script Example
#Import VapourSynth Core
import vapoursynth as vs
core = vs.get_core()
#Import Sharpening Script
import hysteria as hys
#Import Video
video = core.d2v.Source(r’DVD.d2v’)
#Remove dot-crawl artifacts
video = core.tcomb.TComb(video, mode=2)
#Remove rainbowing
video = core.bifrost.Bifrost(video, interlaced=True)
#Restores Progressive Frames
video = core.vivtc.VFM(video, cthresh=10)
#Restores framerate to 23.976fps by removing duplicate frames
video = core.vivtc.VDecimate(video, mode=1)
#Removes film grain and smooths the image
strength = 2
video = core.fft3dfilter.FFT3DFilter(video, bw=6, bh=6, ow=3, oh=3, plane=0, bt=1, sigma=strength)
video = core.fft3dfilter.FFT3DFilter(video, bw=216, bh=216, ow=108, oh=108, plane=0, bt=1, sigma=strength/8, sigma2=strength/4, sigma3=strength/2, sigma4=strength)
#Sharpens lines and edges
video = hys.Hysteria(video)
#Crops all sides to remove blank space yet maintain the aspect ratio
video = core.std.CropRel(video, 8,6,4,4)
#Changes the video to Fullscreen (4:3 Aspect Ratio)
video = video.resize.Spline36(640,480)
#Sets Video Output
video.set_output()
B. Film Source
These sources are digitally captured from the film and many are also remastered to remove visual defects. These sources will usually have very few defects aside from film grain and require minimal filtering to improve the visual quality. Using a Spatio-Temporal filter such as FFT3DFilter or FFT3DGPUis recommended to reduce noise. Below is an example of film grain and an AviSynth script cleaning it.
Before Filtering
AviSynth Script Example
#Input video
MPEG2Source("DVD.d2v")
#Restores progressive frames
tfm()
#Restores framerate to 23.976fps by removing duplicate frames
tdecimate(mode=1)
#Removes film grain and smooths the image
strength = 2
FFT3DFilter(bw=6, bh=6, ow=3, oh=3, plane=0, bt=1, sigma=strength)
FFT3DFilter(bw=216, bh=216, ow=108, oh=108, plane=0, bt=1, sigma=strength/8, sigma2=strength/4, sigma3=strength/2, sigma4=strength)
#Crops all sides to remove blank space yet maintain the aspect ratio
Crop(4,2,-4,-2)
#Changes the video to Fullscreen (4:3 Aspect Ratio)
Spline36Resize(640,480)
VapourSynth Script Example
#Import VapourSynth Core
import vapoursynth as vs
core = vs.get_core()
#Import Video
video = core.d2v.Source(r’DVD.d2v’)
#Restores Progressive Frames
video = core.vivtc.VFM(video, cthresh=10)
#Restores framerate to 23.976fps by removing duplicate frames
video = core.vivtc.VDecimate(video, mode=1)
#Removes film grain and smooths the image
strength = 2
video = core.fft3dfilter.FFT3DFilter(video, bw=6, bh=6, ow=3, oh=3, plane=0, bt=1, sigma=strength)
video = core.fft3dfilter.FFT3DFilter(video, bw=216, bh=216, ow=108, oh=108, plane=0, bt=1, sigma=strength/8, sigma2=strength/4, sigma3=strength/2, sigma4=strength)
#Crops all sides to remove blank space yet maintain the aspect ratio
video = core.std.CropRel(video, 4,4,2,2)
#Changes the video to Fullscreen (4:3 Aspect Ratio)
video = video.resize.Spline36(640,480)
#Sets Video Output
video.set_output()
C. Digital Source
Digital sources typically have very few defects and only require minimal filtering to improve the visual quality. The artifacts you may encounter include mosquito noise, minor macroblocking, and color banding. Since these sources tend to have more detail it is recommended that you avoid deblocking and spatial smoothing filters as they will blur the image and degrade the overall quality. MDegrain, which is part of MVTools, can reduce mosquito noise and minor macroblocking artifacts while preserving details and Flash3kyuu Deband is recommended to handle any banding. Hysteria is suggested to resharpen the edges and lines that become blurred after applying these filters. Below is an example of these visual defects and an AviSynth script that addresses them.
AviSynth Script Example
#Input video
MPEG2Source("DVD.d2v")
#Restores progressive frames
tfm()
#Restores framerate to 23.976fps by removing duplicate frames
tdecimate(mode=1)
#Removes light noise and minor blocking by reading two frames back and ahead
super = MSuper(pel=2, sharp=1)
backward_vec2 = MAnalyse(super, isb = true, delta = 2, overlap=4)
backward_vec1 = MAnalyse(super, isb = true, delta = 1, overlap=4)
forward_vec1 = MAnalyse(super, isb = false, delta = 1, overlap=4)
forward_vec2 = MAnalyse(super, isb = false, delta = 2, overlap=4)
MDegrain2(super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400)
#Repairs banding and dithers
flash3kyuu_deband()
#Sharpens lines and edges
Hysteria()
#Crops all sides to remove blank space yet maintain the aspect ratio
Crop(4,2,-4,-2)
#Changes the video to Fullscreen (4:3 Aspect Ratio)
Spline36Resize(640,480)
VapourSynth Script Example
#Import VapourSynth Core
import vapoursynth as vs
#Import Sharpening Script
import hysteria as hys
core = vs.get_core()
#Import Video
video = core.d2v.Source(r’title#.d2v’)
#Restores Progressive Frames
video = core.vivtc.VFM(video, cthresh=10)
#Restores framerate to 23.976fps by removing duplicate frames
video = core.vivtc.VDecimate(video, mode=1)
#Removes light noise and minor blocking by reading two frames back and ahead
super = core.mv.Super(video, pel=2, sharp=1)
backward_vec2 = core.mv.Analyse(super, isb = True, delta = 2, overlap=4)
backward_vec1 = core.mv.Analyse(super, isb = True, delta = 1, overlap=4)
forward_vec1 = core.mv.Analyse(super, isb = False, delta = 1, overlap=4)
forward_vec2 = core.mv.Analyse(super, isb = False, delta = 2, overlap=4)
video = core.mv.Degrain2(video, super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,thsad=400)
#Repairs banding and dithers
video = core.f3kdb.Deband(video)
#Sharpens lines and edges
video = hys.Hysteria(video)
#Crops all sides to remove blank space yet maintain the aspect ratio
video = core.std.CropRel(video, 4,4,2,2)
#Changes the video to Fullscreen (4:3 Aspect Ratio)
video = video.resize.Spline36(640,480)
#Sets Video Output
video.set_output()