Log in

View Full Version : Hybrid DVD to 24p/30p/60p VFR MKV


Inspector.Gadget
5th June 2009, 22:27
Hi all, I have a question about setting up Avisynth to create a VFR MKV. Basically, I'd like to do the standard hybrid VFR encode with one difference: IVTC film sections, pass true interlaced sections to a double-rate bobber (preferably TempGaussMC()), and leave uncombed 30p sections alone. Here's what I have so far for my first pass script and second pass script: what do I need to do to be be able to double-rate bob sections that TFM detects as combed and leave progressive sections alone?

First script
DGDecode_mpeg2source("C:\Users\matt\Desktop\Salem's Lot\VTS_01_PGC_01_1.d2v", info=3)
ColorMatrix(hints=true, threads=0)
TFM(d2v="C:\Users\matt\Desktop\Salem's Lot\VTS_01_PGC_01_1.d2v",mode=3,PP=1,output="C:\Users\matt\Desktop\Salem's Lot\SL-TFM.txt")
#Deinterlacer (TempGaussMC, I hope)
TDecimate(mode=4,tcfv1=false,output="C:\Users\matt\Desktop\Salem's Lot\SL-TDEC.txt")

Second script
DGDecode_mpeg2source("C:\Users\matt\Desktop\Salem's Lot\VTS_01_PGC_01_1.d2v", info=3)
ColorMatrix(hints=true, threads=0)
TFM(order=-1,d2v="C:\Users\matt\Desktop\Salem's Lot\VTS_01_PGC_01_1.d2v",mode=3,PP=1,input="C:\Users\matt\Desktop\Salem's Lot\SL-TFM.txt")
#Deinterlacer
TDecimate(mode=5,tcfv1=false,hybrid=2,vfrdec=0,input="C:\Users\matt\Desktop\Salem's Lot\SL-TDEC.txt",TFMin="C:\Users\matt\Desktop\Salem's Lot\SL-TFM.txt",output="C:\Users\matt\Desktop\Salem's Lot\SL-timecodes.txt")

I think I have the basics down: index, use TFM to detect frame characteristics and flag interlaced frames, pass these frames to a deinterlacer, decimate film section near-dupes, create timecodes. Thank you very much in advance.:thanks:

thetoof
5th June 2009, 23:40
A wrapper function that does exactly that (though not totally user friendly atm) : AnimeIVTC.

You tell the function when your true interlaced sections start and end (istart1, iend1 and so forth) and it should work.

If you want to do it yourself, you can look at the script to get some ideas.

lansing
6th June 2009, 05:15
AnimeIVTC is your friend, and to put more pressure on thetoof to update it lol

thetoof
6th June 2009, 05:27
haha yeah, you've got a point... I'll see what I can do :o

Inspector.Gadget
6th June 2009, 06:07
Can one of you (or anyone else that happens by) quick-paste a script that you've used with AnimeIVTC to get the desired mix of IVTC'd 24p, untouched 30p, and bobbed 60p from a hybrid source? Besides the hybrid framerates, the rest of the source looks good to me: it's live-action and there's not much aliasing, no blends, no sharpening effects, etc. - I really only need to know how to get the frames detected and passed off to a matcher/deinterlacer/bobber of my choice. Thank you in advance.

Nightshiver
6th June 2009, 12:16
Post a bloody video sample. It's just easier when we have something to work with. Sure, we could throw out some calls that do that, but it might be different when we actually see the source.

Inspector.Gadget
6th June 2009, 15:36
Nightshiver, the movie is about 95% soft telecined and has short interlaced and (what appear) to be progressive sections in different spots, spaced widely apart. I'm not sure a video sample would be that helpful in figuring out how to process these frames: does AnimeIVTC or similar options depend on a manual list of frame types, or are they detected automatically? I'll still post a sample if it will help, but any reasonably-sized section will be at best a few true interlaced frames and the rest soft telecined.

Edit: Here's a sample cut with Avidemux that is a mixture of soft telecined and sections with no pulldown that may be hard telecined but don't feature motion on every frame. I'll see if I can find a better sample, but this is the first mixed content section I found by parsing the D2V.

http://www.mediafire.com/file/zn3yddhhwlm/sample.m2v

Edit: A second sample.

http://www.mediafire.com/file/dzmhozyydqm/sample2.m2v

DarkT
6th June 2009, 15:57
If the progressive is just in a few small parts... I'd just blend it down to 23.976...

Inspector.Gadget
6th June 2009, 16:14
Thanks DarkT, I've done that and while the outcome looks pretty good I'm interested in learning how to do the VFR conversion properly - I'll only watch a movie once, but I have probably hundreds more to encode before I get sick of messing around with Avisynth :)

lansing
6th June 2009, 17:13
your sample video are pretty bad example of a hybrid. I seem it more as a hard telecine source, so something like AnimeIVTC(1, aa=0) will get it done.
In my experience, hybrid exist more often on OP and ED of anime, where sometime half of the song was interlaced and half was telecined.

Nightshiver
6th June 2009, 19:40
VFR in animeivtc is pretty easy and straightforward. First, load this into your script:

animeivtc(mode=5, aa=0, pass=1)

Next, there are 2 ways to do the first pass.
1) Open with vdub, file-run video analysis pass, wait until the end, close vdub. (NOT VDUBMOD)
2) Open MeGUI, run "Video Analysis Pass".

The first pass will create some .txt files. Leave them alone. Next, change your animeivtc line to this:

animeivtc(mode=5, aa=0, pass=2)

This is the final line/your actual encode line. Once you get to this step, make a lossless .avi and then encode. Once done, take the "timecodes.txt" file and add it as the timecode for the video stream in mkvmerge. Now you're done. Yippy.

Inspector.Gadget
6th June 2009, 19:50
Thank you, Nightshiver, I'll do that as soon as I'm done trying to do it manually with TFM. Given my past efforts, AnimeIVTC is sure to be more successful :D

Inspector.Gadget
6th June 2009, 21:11
AnimeIVTC worked quite well. Thank you thetoof, Nightshiver, lansing, and DarkT!

tarantino.mariachi
18th March 2011, 21:51
VFR in animeivtc is pretty easy and straightforward. First, load this into your script:

animeivtc(mode=5, aa=0, pass=1)

Next, there are 2 ways to do the first pass.
1) Open with vdub, file-run video analysis pass, wait until the end, close vdub. (NOT VDUBMOD)
2) Open MeGUI, run "Video Analysis Pass".

The first pass will create some .txt files. Leave them alone. Next, change your animeivtc line to this:

animeivtc(mode=5, aa=0, pass=2)

This is the final line/your actual encode line. Once you get to this step, make a lossless .avi and then encode. Once done, take the "timecodes.txt" file and add it as the timecode for the video stream in mkvmerge. Now you're done. Yippy.

What's the difference between mode=5 and mode=4 in this case?
And in the 1st pass it creates the txt files only?, on the 2nd pass it will create the final encode? And the lossless?
And when do I need to apply the others filters like denoise? In 2nd pass? or after the lossless?:helpful:

Im using animeivtc 2.00. And If I encoded in CFR mode, my line was like this: AnimeIVTC(mode=3,omode=2,edimode="nnedi3",degrain=1,pattern=1,precision=3,cbob=4,bbob=4,pass=1,e1=131989,i1=139323)
Can I create the txt files with only this line in script?

Like, 1st pass:

DGDecode_MPEG2Source("C:\Anime\Mono.d2v", cpu=0, info=3)
ColorMatrix(interlaced=true, hints=true, threads=2)
lanczos4resize(720,480,2,4,-4,-0)
AnimeIVTC(mode=3,omode=2,edimode="nnedi3",degrain=1,pattern=1,precision=3,cbob=4,bbob=4,pass=1,e1=131989,i1=139323)
And after this I suposse it will create the txt files

then I use this script for the 2nd pass:

DGDecode_MPEG2Source("C:\Anime\Mono.d2v", cpu=0, info=3)
ColorMatrix(interlaced=true, hints=true, threads=2)
lanczos4resize(720,480,2,4,-4,-0)
AnimeIVTC(mode=3,omode=2,edimode="nnedi3",degrain=1,pattern=1,precision=3,cbob=4,bbob=4,pass=2,e1=131989,i1=139323)
#Some Denoisers below...

It will create the final mkv file? and then with mkvmerge I merge with the timecodes.txt that I get with the 1st pass?

I have read in making some lossless... but I dont know how to use it. Where do I Create and use the lossless?

Cheers

EDIT: I think I have understand, I use the 2nd pass code without any denoise and encode to an mkv in lossless mode. and then I encode the lossless as the FINAL encode, appliyng the denoise and stuff. Is that correct?

Cheers