PDA

View Full Version : Best Way to Read "IsVideo" Hints to decimate 60i sections properly


pbblair
7th May 2008, 11:02
Hi all,

Inverse telecine with hybrid material is literally giving me nightmares. This is not a beginner's problem, so please give me your thoughts if you like challenges.

I (suddenly) regularly have to deliver 23.976p footage using NTSC SD broadcast masters as sources. This material typically contains:
-90% film material that has been telecined to 29.97i and then edited on a 29.97i timeline (lots of orphaned fields at cuts, but those are easy)
-10% video material (inserts, title sequence shots, occasionally entire scenes shot this way for effect ("show-in-a-show" stylistic choice).

Doing a conventional telecide/decimate results in juttery motion during the 29.97i-native sections. This is because going from 60fields->30 frames->24 frames can't ever be as smooth as 60fields->24 frames directly (see the Convert60iTo24p function for a good implementation).

I have done my homework as much as possible, and my goal is to write a do-it-all script. I don't think it's impossible. Here are my basic observations:

-TDecimate does an amazing job identifying video passages... better than anything else I've tested. Presumably this is because it's doing far more in terms of cycle detection, etc. Everything else seems to be more of combing-detector, more prone to false positives and stray frames.
-TDecimate DOESN'T let me do what I want to do once those frames are detected, which is to replace each one with a simple bobbed-then-decimated-to-24 frame. It wants to blend.
-TSwitch comes very close, because it lets me prepare separate clips using different processes, and then pick frames based on combing hints.
-TSwitch DOESN'T read any hints from TDecimate, which is really the only filter that "knows" enough to give me the hints I want. TDecimate seems to simply destroy any hints that go through it. I understand why, but perhaps this is a strong argument for it to pass an "isVid" hint per frame.

Does anyone have a suggestion? I spent a lot of time with SmartDecimate before coming back to this, which is the best compromise I've found:

Weaved=TFM(PP=7).TDecimate(Mode=7, rate=(24/1.001), hint=false)
Bobbed=MVBob().TDecimate(Mode=7, rate=(24/1.001), hint=false)
Ref=TFM(PP=1, MI=30, cthresh=12).TDecimate(Mode=7, rate=(24/1.001), hint=false).TDeint(tshints=true)
TSwitch(Ref, Weaved, Bobbed)

And here is my make-believe code, if only TDecimate could pass hints to TSwitch:

Weaved=TFM(PP=7).TDecimate(Mode=7, rate=(24/1.001), hint=false)
Bobbed=MVBob().TDecimate(Mode=7, rate=(24/1.001), hint=false)
Ref=TFM(PP=1, MI=30, cthresh=12).TDecimate(Mode=7, rate=(24/1.001), tshints=true)
TSwitch(Ref, Weaved, Bobbed)

nonsens112
7th May 2008, 12:10
pbblair

Typically, hybrid material is being converted to Matroska VFR or 120 fps. Here the required steps are described:
http://avisynth.org/mediawiki/VFR#Opening_MPEG-2_hybrid_video_in_AviSynth_and_re-encoding
Matroska VFR is the most natural way.

Just taking bobbed frames IMO is not a good idea. Because only 24 out of 60 fields per second are taken, serious part of information will be lost or distorted, I think, even with MCBob. People usually make motion-compensated FPS conversion when need to change FPS.

Also, TFM isn't the best field-matching deinterlacer, consider TDeint with external EEDI2- or NNEDI-interpolated clip.

pbblair
7th May 2008, 20:42
Thanks nonsens112.

Ultimately the output HAS to be 23.976p, constant frame rate. This requirement is outside of my control.

TFM is actually not part of the problem for me. The problem is, in short, "how do I use video detection as good as TDecimate's in order to swap out otherwise-juddery video frames with more appropriate bobbed-to-24 frames?" Nothing beats a bob-to-24 (smart bob or otherwise) for motion smoothness in the video sequences.

Using Telecide.Decimate on 60i material will result in jumpier motion because the final output it will skip up to 3 fields at at time. Bob-to-24 (or Bob.Decimate) will only skip up to 2.

pbblair
28th May 2008, 04:02
Telecide (not TFM) has a video detection as well, so maybe there is a way to accomplish what I need using it. Conceptually, something like:

MyBobbedTo24Clip=Bob().Convert60iTo24p()
Telecide(storeIsVidHints=true).Decimate(replaceVidFramesWithClip2=MyBobbedTo24Clip)

Ideally there would be a Decimate (or variant) feature that would read IsVideo hints from Telecide (or variant) and instead of decimating the video sections conventionally, would use frames from Clip2, or better yet, would internally implement the Convert60iTo24p function.