scharfis_brain
20th December 2003, 12:16
Function
function converter(clip input, int x, int y, bool TFF, int "combth", bool "speedup", bool "show")
{
function kernelbob(clip a, int th)
{
f=a.
\kerneldeint(order=0, sharp=true, twoway=true, threshold=th)
e=a.separatefields.trim(1,0).weave.
\kerneldeint(order=1, sharp=true, twoway=true, threshold=th)
interleave(f,e)
}
function speeduphybrid(clip i, int width, int height, bool debug)
{
comb = telecide(i,order=1,post=0).decimate(5)
f = framerate(comb)
film = comb.lanczosresize(width,height).assumefps(25,true)
film = (debug == false) ? film : film.subtitle("film -> IVTC -> speedup")
video = i.kernelbob(5).lanczosresize(width,height).
\convertfps(2*f).assumefps(50,true).separatefields.selectevery(4,0,3).weave
video = (debug == false) ? video : video.subtitle("video -> blending -> speedup")
conditionalfilter(comb,video,film,"iscombed(combthr)","=","true")
}
function speedupfilm(clip i, int width, int height, bool debug)
{
film = i.assumefps(25,true).lanczosresize(width,height)
film = (debug == false) ? film : film.subtitle("film -> speedup")
return film
}
function converthybrid(clip i, int width, int height, bool debug)
{
comb = telecide(i,order=1,post=0).decimate(5)
film = comb.lanczosresize(width,height).
\changefps(50).separatefields.selectevery(4,0,3).weave
film = (debug == false) ? film : film.subtitle("film -> IVTC -> convert")
video = i.kernelbob(5).lanczosresize(width,height).
\convertfps(50).separatefields.selectevery(4,0,3).weave
video = (debug == false) ? video : video.subtitle("video -> blending")
conditionalfilter(convertfps(comb,25),video,film,"iscombed(combthr)","=","true")
}
function convertfilm(clip i, int width, int height, bool debug)
{
film = i.lanczosresize(width,height).
\changefps(50).separatefields.selectevery(4,0,3).weave
film = (debug == false) ? film : film.subtitle("film -> convert")
return film
}
combth = default(combth,20)
global combthr=combth
speed = default(speedup,true)
debug = default(show ,false)
input = (TFF == true) ? input.assumetff : input.assumebff
speedupout = (framerate(input) < 26) ?
\speedupfilm(input,x,y,debug) : speeduphybrid(input,x,y,debug)
convertout = (framerate(input) < 26) ?
\convertfilm(input,x,y,debug) : converthybrid(input,x,y,debug)
final = (speed == true) ? speedupout : convertout
final.resampleaudio(audiorate(input))
}
Usage
loadplugin("...\kerneldeint140.dll")
loadplugin("...\decomb510.dll")
import("...\converter.avs")
avisource("hybrid.avi")
converter(768,576,TFF=true,combth=20,speedup=true,show=false)
this function converts a hybrid NTSC-Video automated
to PAL using IVTC on Telecined Film and blending on
the other parts.
You can decide, wheater the video should be speeded up
by 25/23.976 to get progressive Film-parts.
If no speedup is whished, the Film-parts get interlaced,
too. But with better quality then with stupid blending.
If the input-clip is already 23.976 fps, this will be
detected and just a speedup or conversion from 23.976
to 25 will be made.
Parameters:
x - new width
y - new height
TFF - true for TFF-clips, false for BFF-clips
combth - (default = 20) defines the threshold weather the
.........input clip is interlaced or progressive (telecined)
speedup - (default = true)
show - (default = false) shows, which conversion is applied
.........to the video:
29.97 fps input-clip with speedup gives either
"film -> IVTC -> speedup" or "video -> blending -> speedup"
29.97 fps input-clip without speedup gives either
"film -> IVTC -> convert" or "video -> blending"
23.976 fps input-clip shows:
with speedup "film -> speedup"
without speedup "film -> convert"
The Audio stays always in sync with the Video.
function converter(clip input, int x, int y, bool TFF, int "combth", bool "speedup", bool "show")
{
function kernelbob(clip a, int th)
{
f=a.
\kerneldeint(order=0, sharp=true, twoway=true, threshold=th)
e=a.separatefields.trim(1,0).weave.
\kerneldeint(order=1, sharp=true, twoway=true, threshold=th)
interleave(f,e)
}
function speeduphybrid(clip i, int width, int height, bool debug)
{
comb = telecide(i,order=1,post=0).decimate(5)
f = framerate(comb)
film = comb.lanczosresize(width,height).assumefps(25,true)
film = (debug == false) ? film : film.subtitle("film -> IVTC -> speedup")
video = i.kernelbob(5).lanczosresize(width,height).
\convertfps(2*f).assumefps(50,true).separatefields.selectevery(4,0,3).weave
video = (debug == false) ? video : video.subtitle("video -> blending -> speedup")
conditionalfilter(comb,video,film,"iscombed(combthr)","=","true")
}
function speedupfilm(clip i, int width, int height, bool debug)
{
film = i.assumefps(25,true).lanczosresize(width,height)
film = (debug == false) ? film : film.subtitle("film -> speedup")
return film
}
function converthybrid(clip i, int width, int height, bool debug)
{
comb = telecide(i,order=1,post=0).decimate(5)
film = comb.lanczosresize(width,height).
\changefps(50).separatefields.selectevery(4,0,3).weave
film = (debug == false) ? film : film.subtitle("film -> IVTC -> convert")
video = i.kernelbob(5).lanczosresize(width,height).
\convertfps(50).separatefields.selectevery(4,0,3).weave
video = (debug == false) ? video : video.subtitle("video -> blending")
conditionalfilter(convertfps(comb,25),video,film,"iscombed(combthr)","=","true")
}
function convertfilm(clip i, int width, int height, bool debug)
{
film = i.lanczosresize(width,height).
\changefps(50).separatefields.selectevery(4,0,3).weave
film = (debug == false) ? film : film.subtitle("film -> convert")
return film
}
combth = default(combth,20)
global combthr=combth
speed = default(speedup,true)
debug = default(show ,false)
input = (TFF == true) ? input.assumetff : input.assumebff
speedupout = (framerate(input) < 26) ?
\speedupfilm(input,x,y,debug) : speeduphybrid(input,x,y,debug)
convertout = (framerate(input) < 26) ?
\convertfilm(input,x,y,debug) : converthybrid(input,x,y,debug)
final = (speed == true) ? speedupout : convertout
final.resampleaudio(audiorate(input))
}
Usage
loadplugin("...\kerneldeint140.dll")
loadplugin("...\decomb510.dll")
import("...\converter.avs")
avisource("hybrid.avi")
converter(768,576,TFF=true,combth=20,speedup=true,show=false)
this function converts a hybrid NTSC-Video automated
to PAL using IVTC on Telecined Film and blending on
the other parts.
You can decide, wheater the video should be speeded up
by 25/23.976 to get progressive Film-parts.
If no speedup is whished, the Film-parts get interlaced,
too. But with better quality then with stupid blending.
If the input-clip is already 23.976 fps, this will be
detected and just a speedup or conversion from 23.976
to 25 will be made.
Parameters:
x - new width
y - new height
TFF - true for TFF-clips, false for BFF-clips
combth - (default = 20) defines the threshold weather the
.........input clip is interlaced or progressive (telecined)
speedup - (default = true)
show - (default = false) shows, which conversion is applied
.........to the video:
29.97 fps input-clip with speedup gives either
"film -> IVTC -> speedup" or "video -> blending -> speedup"
29.97 fps input-clip without speedup gives either
"film -> IVTC -> convert" or "video -> blending"
23.976 fps input-clip shows:
with speedup "film -> speedup"
without speedup "film -> convert"
The Audio stays always in sync with the Video.