Log in

View Full Version : Tdecimate vs Subtitles


hamsterstyle
17th August 2010, 00:51
Hey All. I have an avisynth question that I hope you can all answer.

I have a piece of video that is 1920x1080, with subtitles. the video is 3-2 telecine.

A standard IVT works fine.

TFM()

However, the telecine cadence of the video, is different from the subtitles. At some points in the video, we have two frames that repeat, however only one of the frames has the subtitle on it. Thus tdecimate fails to correctly decimate.

My fix is to crop off the subtitles, run tdecimate(output="temp.txt"), then rerun the script normally with tdecimate(input="temp.txt").

Is there any way to do this with only one pass, or to do it more intelligently?

manono
17th August 2010, 07:59
There are a couple of ways to do this in a single pass. One is to remove the bottom however many pixels only for the purposes of the field matching. From the TFM readme:
y0/y1 -

These define an exclusion band which excludes the lines between y0 and y1 from
being included in the field matching decision. An exclusion band can be used
to ignore subtitles, a logo, or other things that may interfer with the matching.
y0 sets the starting scan line and y1 sets the ending line, all lines in between
y0 and y1 (including y0 and y1) will be ignored. Set y0 equal to y1 to disable.

The entire original resolution will be outputted. The other is by using a clip2. From the TDecimate readme:
clip2 -

Allows specification of a second clip from which to take frames. Metric calculation
and decimation are still done on the input clip, but the frames that tdecimate
returns are from clip2. Clip2 must have the same number of frames are the input clip
and be in YUY2 or YV12 colorspace (it does not have to have the same colorspace as
the input clip).
So, something like this works:
Clip2=AVISource("E:\Path\To\Video.avi")
PClip=Clip2.Crop(0,0,0,-60)#Adjust for the height of the subs
TFM(PClip)
TDecimate(Clip2)
You crop for the purposes of the field matching, but output uncropped frames.

hamsterstyle
18th August 2010, 17:14
thanks Manono, that was exactly what I was looking for.