hydra3333
2nd November 2009, 04:53
I have a 100Mb home video clip from a samsung s630 (a small stills camera that can also record video) and mediainfo tells me the clip is 30fps, 640x480, progressive mjpeg. Most of the clip is indoors with "moderate" lighting.
I'm looking to turn the clip into PAL DVD (ie the script is input to HC023) and so have cobbled together the draft script, with re-used code, below. Audio will be processed separately,
Can any suggest improvements (or replacement) to maximize quality ? Processing time is not an issue.
#loadplugin("C:\Program Files\Haali\MatroskaSplitter\avss.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins-zzz\mt_masktools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins-zzz\mvtools2.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins-zzz\Convolution3d.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins-zzz\AGC.dll")
#dss2("c:\i\input.avi",fps=30) #DirectShowSource2
AVIsource("c:\i\input.avi",audio=false)
AssumeFPS(30)
global resizeWidth = 0
global resizeHeight = 0
global resizeBorderHalfHeight = 0
bh = zzzCalcResize(LAST, 720, 576)
super = last.MSuper(pel=2,sharp=2)
backward_vec = MAnalyse(super,isb=true,truemotion=true,delta=1,chroma=true,blksize=4,overlap=2)
forward_vec = MAnalyse(super,isb=false,truemotion=true,delta=1,chroma=true,blksize=4,overlap=2)
MFlowFps(super, backward_vec, forward_vec, num=25, den=1, ml=100)
AssumeFPS(25)
ConvertToYUY2(interlaced=FALSE)
Convolution3D(0, 6, 10, 6, 8, 2.8, 0)
# HDRAGC *can't* be used inside MT or AGC will be calculated differently in each slice
HDRAGC(coef_gain=0.1, min_gain=0.1, max_gain=0.5, coef_sat=1.0, corrector=0.8, reducer=2.0, black_clip=1.0)
lanczos4resize(resizeWidth,resizeHeight).LimitedSharpenFaster(smode=4,strength=100)
Addborders(0, resizeBorderHalfHeight, 0, resizeBorderHalfHeight)
Converttoyv12()
#-----------------------------------------------------------------------------------------------------------------------
# re-use old function to calculate resizing and border sizes
Function zzzCalcResize(clip c, int desiredWidth, int desiredHeight) {
global resizeWidth = 0
global resizeHeight = 0
global resizeBorderHalfHeight = 0
ratio=((c.width()+.0)/(c.height()+.0))+.0
ratio=(ratio<1.33333) ? 1.333333 : ratio
halfheight43=(round(c.width()/1.33333)-c.height())/2
#What would be the height keeping the aspect ratio if width was 640/320-NTSC or 768/384-PAL(4:3)
no_borders_height1=(c.height() < desiredHeight)? c.height() : desiredHeight
#4:3
no_borders_height1=(desiredHeight == 480) ? floor(640*(1/ratio)) : no_borders_height1
no_borders_height1=(desiredHeight == 240) ? floor(320*(1/ratio)) : no_borders_height1
no_borders_height1=(desiredHeight == 576) ? floor(768*(1/ratio)) : no_borders_height1
no_borders_height1=(desiredHeight == 288) ? floor(384*(1/ratio)) : no_borders_height1
#Now how much we have to shrink to make it fit inside a macroblock?
#mod16height=no_borders_height1 % 16
mod2height=no_borders_height1 % 2
#If the rest is <=8, subtracts the rest, else, completes to 16.
#completion= (mod16height <= 8) ? (-mod16height) : (16-mod16height)
#no_borders_height2=no_borders_height1+completion
no_borders_height2=no_borders_height1-mod2height
#finally Return resize parameters
global resizeWidth = desiredWidth
global resizeHeight = (c.width() == 704) && (desiredWidth == 704) ? c.height()-(c.height() % 2) : no_borders_height2
global resizeHeight = (c.width() == 720) && (desiredWidth == 720) ? c.height()-(c.height() % 2) : no_borders_height2
global resizeBorderHalfHeight = (desiredHeight-resizeHeight)/2
return resizeBorderHalfHeight
}
SetPlanarLegacyAlignment(True)
EDIT1: Hmm error "could not locate decompressor for MJPG" ... ?
EDIT2: ffdshow fixed that. Now "Error in MVFLOWFPS: mvbw's overlap size is incorrect" ?
EDIT3: typo mvanalyse -> manalyze
I'm looking to turn the clip into PAL DVD (ie the script is input to HC023) and so have cobbled together the draft script, with re-used code, below. Audio will be processed separately,
Can any suggest improvements (or replacement) to maximize quality ? Processing time is not an issue.
#loadplugin("C:\Program Files\Haali\MatroskaSplitter\avss.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins-zzz\mt_masktools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins-zzz\mvtools2.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins-zzz\Convolution3d.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins-zzz\AGC.dll")
#dss2("c:\i\input.avi",fps=30) #DirectShowSource2
AVIsource("c:\i\input.avi",audio=false)
AssumeFPS(30)
global resizeWidth = 0
global resizeHeight = 0
global resizeBorderHalfHeight = 0
bh = zzzCalcResize(LAST, 720, 576)
super = last.MSuper(pel=2,sharp=2)
backward_vec = MAnalyse(super,isb=true,truemotion=true,delta=1,chroma=true,blksize=4,overlap=2)
forward_vec = MAnalyse(super,isb=false,truemotion=true,delta=1,chroma=true,blksize=4,overlap=2)
MFlowFps(super, backward_vec, forward_vec, num=25, den=1, ml=100)
AssumeFPS(25)
ConvertToYUY2(interlaced=FALSE)
Convolution3D(0, 6, 10, 6, 8, 2.8, 0)
# HDRAGC *can't* be used inside MT or AGC will be calculated differently in each slice
HDRAGC(coef_gain=0.1, min_gain=0.1, max_gain=0.5, coef_sat=1.0, corrector=0.8, reducer=2.0, black_clip=1.0)
lanczos4resize(resizeWidth,resizeHeight).LimitedSharpenFaster(smode=4,strength=100)
Addborders(0, resizeBorderHalfHeight, 0, resizeBorderHalfHeight)
Converttoyv12()
#-----------------------------------------------------------------------------------------------------------------------
# re-use old function to calculate resizing and border sizes
Function zzzCalcResize(clip c, int desiredWidth, int desiredHeight) {
global resizeWidth = 0
global resizeHeight = 0
global resizeBorderHalfHeight = 0
ratio=((c.width()+.0)/(c.height()+.0))+.0
ratio=(ratio<1.33333) ? 1.333333 : ratio
halfheight43=(round(c.width()/1.33333)-c.height())/2
#What would be the height keeping the aspect ratio if width was 640/320-NTSC or 768/384-PAL(4:3)
no_borders_height1=(c.height() < desiredHeight)? c.height() : desiredHeight
#4:3
no_borders_height1=(desiredHeight == 480) ? floor(640*(1/ratio)) : no_borders_height1
no_borders_height1=(desiredHeight == 240) ? floor(320*(1/ratio)) : no_borders_height1
no_borders_height1=(desiredHeight == 576) ? floor(768*(1/ratio)) : no_borders_height1
no_borders_height1=(desiredHeight == 288) ? floor(384*(1/ratio)) : no_borders_height1
#Now how much we have to shrink to make it fit inside a macroblock?
#mod16height=no_borders_height1 % 16
mod2height=no_borders_height1 % 2
#If the rest is <=8, subtracts the rest, else, completes to 16.
#completion= (mod16height <= 8) ? (-mod16height) : (16-mod16height)
#no_borders_height2=no_borders_height1+completion
no_borders_height2=no_borders_height1-mod2height
#finally Return resize parameters
global resizeWidth = desiredWidth
global resizeHeight = (c.width() == 704) && (desiredWidth == 704) ? c.height()-(c.height() % 2) : no_borders_height2
global resizeHeight = (c.width() == 720) && (desiredWidth == 720) ? c.height()-(c.height() % 2) : no_borders_height2
global resizeBorderHalfHeight = (desiredHeight-resizeHeight)/2
return resizeBorderHalfHeight
}
SetPlanarLegacyAlignment(True)
EDIT1: Hmm error "could not locate decompressor for MJPG" ... ?
EDIT2: ffdshow fixed that. Now "Error in MVFLOWFPS: mvbw's overlap size is incorrect" ?
EDIT3: typo mvanalyse -> manalyze