Log in

View Full Version : Please critique my hybrid processing workflow


kumi
22nd December 2007, 22:59
Hi all,

I have this series of hybrid NTSC DVDs that I wish to convert to X264 (constant framerate.) It's my first time working in earnest with hybrid... what a nightmare... although TIVTC was surprisingly easy to use. So, yesterday I spent many hours tackling the first of the set, and finally I got something I can live with. Here's an abbreviated example of the script:

MPEG2Source("G:\VTS_01_1.d2v",idct=6).AssumeBFF()
AudioDub(last, NicAC3Source("G:\VTS_01_1 T01 2_0ch 192Kbps DELAY 0ms.ac3", 2))

# "aclip" is progressive,
# bottom fields are poor quality,
# top fields are high quality...
# So we re-interpolate the bottom fields
#
aclip = Trim2(0, 6521)
aclip = aclip.NNEDI(field=1)

# "bclip" has this wierd repeating pattern:
# 2:2:1:1:2:2:1:1:1:1
#
# TFM+tdecimate does an acceptable job
#
bclip = trim2(6521, 7061)
bclip = bclip.TFM().tdecimate(mode=0, hybrid=3)

# "cclip" is true interlaced
#
cclip = trim2(7061, 10218)
cclip = cclip.yadif()

# "dclip" is progressive,
# "." is HQ field, "x" is LQ field:
# . x . x . x . x etc...
# x . x . x . x . etc...
#
# ... so we re-interpolate "x":
#
dclip = Trim2(10218, 11977)
dclip = dclip.NNEDI(field=2).selectevery(4,1,2)
deven = dclip.selecteven.ChromaShift(L=2)
dodd = dclip.selectodd
dclip = interleave(deven, dodd)

aclip ++ bclip ++ cclip ++ dclip
spline36resize(640, 480)



The actual script is longer (it goes up to "pclip"...), but you can see the 4 different types of video present:
1) True interlaced
2) 2:2:1:1:2:2:1:1:1:1
3) Progressive with ugly bottom fields
4) Progressive with "alternatingly ugly" bottom/top fields

(these 4 types are in the rest of the DVDs of the series.)

So my process was to Separatefields() and mark the different segments in AvsP, and then manually insert trim()s and apply individual processing to each segment. I'm making a few functions to speed it up a bit, but it's still going to be a slow process :p

I just wonder if you, the more experienced AviSynth user, might go about tackling this kind of source differently? Do you see any potential here for shortcuts? Perhaps a way to automatically find the segment types? Or the transitions in between? I have another 7 of these DVDs to go; any pointers you can offer in the way of speeding this up would be most helpful.