View Full Version : New IVTC Filter For Avisynth
spudboy
3rd February 2002, 13:12
Is anyone interested in yet another new IVTC filter? I like using TMPGEnc to perform IVTC, so I wrote a filter to read the IVTC information from a TMPGEnc project file (.tpr) and allow through only those frames chosen by TMPGEnc.
The filter does not do any analysis of its own on the stream, it simply passes through those frames chosen by TMPGEnc. This means that no interlacing or other modifications are done. It does have the advantage though that you can run IVTC in TMPGEnc and then view and tweak the results before using them.
I use the filter in DVD2SVCD as follows:
1) Choose ivtc on the DVD2AVI tab
2) Choose to edit the avisynth file after DVD2AVI step
3) Add a LoadPlugin command to the avisynth script for the filter
4) After the mpeg2source line, add a DoubleWeave command
5) After the DoubleWeave, add TMPGEncIVTC with the .tpr as paramater
6) Let DVD2SVCD run
I have tested it with TMPGEnc 2.2, and am running a test with 2.51 as I write this. I have also tested it with "Crouching Tiger, Hidden Dragon" and "You've Got Mail" movies, and it worked great. I would like to test it with several more movies as well, but everything seems to work at this point.
If anyone is interested, let me know and I will try to find a way to get you the filter.
- spudboy
daxab
10th February 2002, 23:21
I would really like to try this out. Can you make it available?
daxab
11th February 2002, 21:36
Well, I got bored last night, and impatient, so I coded up this plugin. If one version of it is good, then two must be better, right :)? Apologies to spudboy for stealing his idea, but the code is all new. Works fine with TMPG 12j (I know, ancient). I will test it with a later version but it should work fine; it's flexible in the way it parses the TPR file. Error checking is very robust so if anything isn't as expected it will let you know. Performance is fast since all it does is a single array lookup and serves up the frame. Once the IVTC has been done in TMPGEnc, there is no additional time cost (so for a 4-pass encode you don't pay 4 times).
There's no documentation, other than spudboy's post above. Usage is identical, except this is called "tprivtc.dll" to distinguish it.
spudboy
12th February 2002, 23:22
daxab -
You are a dirty code thief!
Actually, I don't care if you took the idea. Since you have implemented this as well, I was wondering how you interpreted the ivtc data. I searched the file for the string "Video.DeinterlaceEx.List", then read a count of ivtc frames at some offset (I think it was like 9 bytes after that), advanced 4 more bytes, and then read the ivtc data. Is there a better way of doing this? I have tried this with one of the latest versions (2.51) and it works. It was indeed a very simple filter to implement--as you said, it is just an array lookup.
- spudboy
spudboy
13th February 2002, 03:00
daxab -
In addition to saving encoding time due to the fact that ivtc only has to be run once, there is another potential advantage to this filter. If someone else has already run ivtc in tmpgenc and saved the .tpr file, they could send this file to others who also wish to back up the dvd. This would mean that you don't have to run ivtc at all. Just a thought.
- spudboy
daxab
13th February 2002, 05:35
@spudboy
Good point (about the .tpr sharing) -- I didn't think of that.
My implementation sounds to be exactly like yours. I do a scan for "Video.DeinterlaceEx.List", then read a 13 byte header. At offset 1 in this header is a longword with the length of the int array + 8. I read the int array (6-byte ints) and save them for later lookup.
The most time consuming part of writing the whole filter was just figuring out the file format. The coding is straightforward. In my final code, most of the lines are error checking, since the all the .tpr file format stuff is guesswork, and could be wrong in future versions.
One thing -- after all this work I was disappointed to see that TMPGEnc isn't perfect either, and can get things wrong, just as GreedyHMA and Decomb can. They each have their weak points -- I have clips that trip up each of them in different spots. I guess there isn't a perfect IVTC solution out there...yet.
spudboy
13th February 2002, 12:05
daxab -
You are right, tmpgenc is not perfect. But at least you have the option of tweaking the results before encoding with them. If tmpgenc gets it wrong (and you happen to notice it) you can modify it manually, save it to the .tpr file, and then encode. My understanding with the other methods is that once you've chosen your initial settings, you are committed.
- spudboy
daxab
27th March 2002, 20:56
People are having trouble downloading the attachment so I put the tprivtc file up here:
http://www.geocities.com/daxab88
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.