Log in

View Full Version : Manual IVTC - Possible ways?


dragon_warrior
5th June 2011, 10:22
Well, after coming across quite a few tricky videos that couldn't get completely free from artifacts using automatic IVTC, I decided to give a try at manual IVTC. Here are several possible ways I've googled up so far:

#1. TMPGEnc Plus: I found the guide here very detailed and useful

http://www.doom9.org/index.html?/mpg/tmpg-ivtc.htm, but still some questions coming up:

1.1. How to load the project file (.tpr) into Avisynth?
1.2. How to handle those interlaced parts using external deinterlacer?

#2. Doubleweave + Pulldown + Trim
doubleweave()
p1=pulldown(...).trim(...)
p2=pulldown(...).trim(...).some_filters(...)
p1+p2

Easy, effective, it allows me to apply different filters to different parts but it's way too slow.

#3. Semi-auto (TIVTC + Frame Replace)
Function R(clip src, clip enc, int frame)
{
trim(src,0,frame-1) + trim(enc,frame,-1) + trim(src,frame+1,0)
}
tfm(clip2=nnedi3)
x=tfm(pp=0).nnedi3()
R(x,1)
R(x,2)
....


Easy, effective, fast (compared to #1 & #2), but it requires so many splices and trims that it prevents x264 from outputting exactly what has been previewed in AvsPMod.

So I need some help to solve these abovementioned problems and find other ways to IVTC properly.

Any help would be very appreciated, thanks.

TinTime
5th June 2011, 11:06
If you want manual control over TFM then have a look at the ovr and ovrDefault parameters.

These let you specify what you want to do in an external file.

Chikuzen
5th June 2011, 12:04
1.1. How to load the project file (.tpr) into Avisynth?

TPRIVTC
http://avisynth.org/warpenterprises/files/tprivtc_25_dll_20040930.zip

dragon_warrior
5th June 2011, 15:31
TPRIVTC
http://avisynth.org/warpenterprises/files/tprivtc_25_dll_20040930.zip

Do I need to convert yv12 to rgb or vice versa?

Myrsloik
5th June 2011, 17:08
You may want to try yatta (http://ivtc.org/) which allows you to use the decisions of tfm/telecide as a starting point and then manually improve the decisions. It was more or less created to help with the script generation for method #3.

Gavino
5th June 2011, 17:20
Function R(clip src, clip enc, int frame)
{
trim(src,0,frame-1) + trim(enc,frame,-1) + trim(src,frame+1,0)
}
...
R(x,1)
Note that because of the properties of Trim, your function does not work properly for frame=1.
Similarly, it fails for frame=0 or the last frame.
Write it like this:
Function R(clip src, clip enc, int frame)
{
v = trim(enc,frame,-1)
v = frame > 0 ? trim(src,0,-frame)+v : v
v = frame+1 < src.Framecount ? v+trim(src,frame+1,0) : v
return v
}

dragon_warrior
6th June 2011, 03:54
Note that because of the properties of Trim, your function does not work properly for frame=1.
Similarly, it fails for frame=0 or the last frame.
Write it like this:
Function R(clip src, clip enc, int frame)
{
v = trim(enc,frame,-1)
v = frame > 0 ? trim(src,0,-frame)+v : v
v = frame+1 < src.Framecount ? v+trim(src,frame+1,0) : v
return v
}

Thanks but it doesn't work, either (the preview is fine, btw)

Gavino
6th June 2011, 09:49
Thanks but it doesn't work, either (the preview is fine, btw)
Well, the function itself certainly works now.

Easy, effective, fast (compared to #1 & #2), but it requires so many splices and trims that it prevents x264 from outputting exactly what has been previewed in AvsPMod.
I don't get this. I thought I saw in one of your previous posts that this was a memory problem. But splices and trims have almost zero memory requirements.

dragon_warrior
6th June 2011, 10:38
I don't get this. I thought I saw in one of your previous posts that this was a memory problem. But splices and trims have almost zero memory requirements.

Well, seems like D'zzy's case here: http://forum.doom9.org/showpost.php?p=1310714&postcount=3. Does setting SetMemoryMax(..) save the day? My computer is running on a 2GB RAM

A solution that worked for me
1. Break out the script into pieces, which are to be rendered to lossless AVI files.
2. Join them all and encode to h264

Consequences:
1. Can't use AVISource as a source filter because the color is off => have to use FFVideoSource instead
2. The final output tends to display more blockiness than the source

Gavino
6th June 2011, 11:40
Well, seems like D'zzy's case here: http://forum.doom9.org/showpost.php?p=1310714&postcount=3.
I think the memory problems in that script are to do with the repeated use of ImageSource, not the trimming and splicing per se.

Actually, however, although trim and splice use no memory of their own, each Trim instance will be accompanied by a cache which does use up memory. So using SetMemoryMax to limit the total cache size will help, making more memory available for other purposes (eg the encoder).

dragon_warrior
6th June 2011, 14:08
I think the memory problems in that script are to do with the repeated use of ImageSource, not the trimming and splicing per se.

Actually, however, although trim and splice use no memory of their own, each Trim instance will be accompanied by a cache which does use up memory. So using SetMemoryMax to limit the total cache size will help, making more memory available for other purposes (eg the encoder).

First, thanks for the clear explanation and nice suggestion
Well, I try adding SetMemoryMax after tfm() and before making frame replacement but it doesn't work :confused:

AzraelNewtype
7th June 2011, 08:13
Well, I try adding SetMemoryMax after tfm() and before making frame replacement but it doesn't work :confused:

It should be the first non-loadplugin/import line of the script.

dragon_warrior
7th June 2011, 12:21
It should be the first non-loadplugin/import line of the script.

Yep, I did put it right at the first line of my script, but nothing's changed. Looks like my hardware isn't capable of doing such kind of encoding