Zarxrax
26th February 2006, 23:51
Edit: With the release of TDeint 1.0 RC3, this function is now obsolete. This function also was found to cause some problems in certain situations, so you shouldn't use it anymore. Now, you can effectively do the same thing as this function (but better) as follows:
deinted = tdeint(mode=2)
tfm(clip2=deinted)
Of course there are lots of settings that would need to be tweaked, but thats the basis of it.
Here is a function I have been working on and tweaking over the past few weeks. It is designed to combine the best qualities of both TIVTC and TDeint+BlendBob. It's quite a simple function though, and not difficult to understand.
First, lets see the advantages and disadvantages of each method on its own:
TIVTC:
+Fast
+Very powerful, lots of matching modes
-It can fail quite often on small details, requiring postprocessing of the frame
-The postprocessing looks like crap
TDeint+BlendBob:
+Easy to use and just works most of the time.
+Visually identical to correct TIVTC output.
-Slow
-Doesn't have as many matching modes as TIVTC, so it can fail on some parts, notably at scene changes or bad edits, causing blended frames.
ZIVTC
My function works by using TFM to perform field matching, and then uses TDeint+BlendBob on only the frames that need to be postprocessed. This results in a speed almost as fast as just using TIVTC (if the source is fairly clean). Because the output of TDeint+BlendBob is nearly identical to the output of TIVTC, you can set cthresh to a very low setting in order to ensure no interlaced frames slip through. When frames are postprocessed unnecessarily, you don't have to worry about the frame looking crappy.
#ZIVTC 1.1 created by Zarxrax (3/08/2006)
#Based on MatchBob by RaistlinMajere
#Required plugins: TIVTC, TDeint, BlendBob
#Purpose: To achieve nice and near-effortless IVTC of anime.
#
#Parameters: Order sets the field order of the clip. 0 is bottom field first, 1 is top field first. Default is -1 (autodetect).
# Mode sets the field matching mode in TFM. Try changing this if there are field matching problems. Default 1. See TFM documentation for description of each mode.
# cthresh sets combed frame detection. Lower values will catch more combed frames, but are slower. Recommended value 2-6. Default 4.
# pp=false will disable postprocessing. This is only useful if you need fast speed temporarily (such as when doing video editing).
# Use display=true to see which frames are being detected as combed.
#
#Example Usage: MPEG2Source("video.d2v").ZIVTC().Tdecimate(mode=1)
#
function ZIVTC(clip c, int "order", int "mode", bool "pp", int "cthresh", bool "display") {
odr = default(order,-1)
mod = default(mode,1)
ppr = default(pp,true)
cth = default(cthresh,4)
dpl = default(display,false)
pproc = (ppr==true) ? 2 : 0
error = BlankClip(c).ConvertToYV12().Subtitle("Error: ZIVTC requires YV12 colorspace.").Subtitle(align=4,"Use ConvertToYV12(interlaced=true)")
c = c.IsYV12 ? c : error
deint = c.TDeint(order=odr, mode=1, mtnmode=3).BlendBob()
c.TFM(order=odr, mode=mod, pp=pproc, cthresh=cth, slow=2, clip2=deint, display=dpl)
}
Mode is probably the most important setting. If you notice blended frames around scene changes or some such, try setting mode to 2 or 3 or something.
Changlog:
Version 1.1 - March 08, 2006
- Removed the extra TFM(). It seems it was unnecessary and caused problems in some situations. This should result in a small speed boost.
- Added pp setting to enable/disable postprocessing.
- No longer uses global variables.
- Checks if the input is YV12, and display an error if it isn't.
Version 1.0 - February 26, 2006
- Original Release
deinted = tdeint(mode=2)
tfm(clip2=deinted)
Of course there are lots of settings that would need to be tweaked, but thats the basis of it.
Here is a function I have been working on and tweaking over the past few weeks. It is designed to combine the best qualities of both TIVTC and TDeint+BlendBob. It's quite a simple function though, and not difficult to understand.
First, lets see the advantages and disadvantages of each method on its own:
TIVTC:
+Fast
+Very powerful, lots of matching modes
-It can fail quite often on small details, requiring postprocessing of the frame
-The postprocessing looks like crap
TDeint+BlendBob:
+Easy to use and just works most of the time.
+Visually identical to correct TIVTC output.
-Slow
-Doesn't have as many matching modes as TIVTC, so it can fail on some parts, notably at scene changes or bad edits, causing blended frames.
ZIVTC
My function works by using TFM to perform field matching, and then uses TDeint+BlendBob on only the frames that need to be postprocessed. This results in a speed almost as fast as just using TIVTC (if the source is fairly clean). Because the output of TDeint+BlendBob is nearly identical to the output of TIVTC, you can set cthresh to a very low setting in order to ensure no interlaced frames slip through. When frames are postprocessed unnecessarily, you don't have to worry about the frame looking crappy.
#ZIVTC 1.1 created by Zarxrax (3/08/2006)
#Based on MatchBob by RaistlinMajere
#Required plugins: TIVTC, TDeint, BlendBob
#Purpose: To achieve nice and near-effortless IVTC of anime.
#
#Parameters: Order sets the field order of the clip. 0 is bottom field first, 1 is top field first. Default is -1 (autodetect).
# Mode sets the field matching mode in TFM. Try changing this if there are field matching problems. Default 1. See TFM documentation for description of each mode.
# cthresh sets combed frame detection. Lower values will catch more combed frames, but are slower. Recommended value 2-6. Default 4.
# pp=false will disable postprocessing. This is only useful if you need fast speed temporarily (such as when doing video editing).
# Use display=true to see which frames are being detected as combed.
#
#Example Usage: MPEG2Source("video.d2v").ZIVTC().Tdecimate(mode=1)
#
function ZIVTC(clip c, int "order", int "mode", bool "pp", int "cthresh", bool "display") {
odr = default(order,-1)
mod = default(mode,1)
ppr = default(pp,true)
cth = default(cthresh,4)
dpl = default(display,false)
pproc = (ppr==true) ? 2 : 0
error = BlankClip(c).ConvertToYV12().Subtitle("Error: ZIVTC requires YV12 colorspace.").Subtitle(align=4,"Use ConvertToYV12(interlaced=true)")
c = c.IsYV12 ? c : error
deint = c.TDeint(order=odr, mode=1, mtnmode=3).BlendBob()
c.TFM(order=odr, mode=mod, pp=pproc, cthresh=cth, slow=2, clip2=deint, display=dpl)
}
Mode is probably the most important setting. If you notice blended frames around scene changes or some such, try setting mode to 2 or 3 or something.
Changlog:
Version 1.1 - March 08, 2006
- Removed the extra TFM(). It seems it was unnecessary and caused problems in some situations. This should result in a small speed boost.
- Added pp setting to enable/disable postprocessing.
- No longer uses global variables.
- Checks if the input is YV12, and display an error if it isn't.
Version 1.0 - February 26, 2006
- Original Release