Log in

View Full Version : 23.976 telecined with blending fields into 29.970


yantei
29th June 2005, 15:50
Hello,

I've been trying to restore progressive frames out of 29.970 fps material (telecined with blended fields).

Have You got any ideas how to do it?


You can download sample of this material from http://213.17.239.190/s4/kairo/xvid_excerpt.avi (2 MB)



Yantei

unskinnyboy
29th June 2005, 16:02
You have to Inverse Telecine the telecined material to retrieve the progressive frames. (http://www.doom9.org/ivtc-tut.htm).

scharfis_brain
29th June 2005, 16:17
this is the script, the made the sample blend-free:

loadplugin("D:\x\tdeint.dll")

function yantei(clip i, int off)
{
a=i.tdeint(mode=1).selectevery(5,off)
b=i.doubleweave().selectevery(5,off+1)
interleave(a,b)
}

avisource("xvid_excerpt.avi")
assumetff()
yantei(1)

you'll need tdeint.dll

the pattern of your video is this:

-||:--||:--||:-

- -> blend
| -> clean field
: -> duplicated clean field.

the function selects the right frames of this pattern, but the user (you, hehe) has to specify the pattern offset manually.

everytime the pattern breaks (blends and combed frames in the output)
you need to trim the source video and call the function wit another offset value.
the offset value may vary between 0 and 4.

mg262
29th June 2005, 17:49
@yantei

Sorry I wasn't much help in the other thread! FWIW, when you're dealing with DVD source, you can cut a small section as a .VOB (using DVD Decrypter) and post that.
___________________

I got the clip and it did look like something that had been telecined and then resized... does that sound right? Anyway, between seeing the clip and seeing this thread I thought of a way to deal with such material so I thought I'd put it up to see what people thought:

(Edit: I've just looked back at @scharfis_brain's post and I was clearly wrong about it being resized telecined stuff. Sorry for wasting your time guys!)

The telecine pattern looks like this (from the docs):
A B C D D (30fps)
A B B C D(For the moment, I'm not going to distinguish top and bottom fields, to keep the argument is simple... it can be extended.)

When the resizing occurs, the two fields are blended together, to get something like this (in terms of frames)

A, B, (B+C)/2, (C+D)/2, D, ...

Numbering the output frames, it looks like this:
F0 = A
F1 = B
F2 = (B+C)/2
F3 = (C+D)/2
F4 = D, ...

So we have the original frames A, B, D present as F0, F1, F4 and all we have to do is get hold of C. That's easy:

C = 2*F1 - F2

Of course you could also use C = 2*F3 - F4... or average the two. In fact, I think that if you know both the original resolution which the stuff was resized from and the resizing algorithm, you can solve this in a way that respects top and bottom fields -- i.e. you can recover (the resized version of) C in a way that is mathematically exact -- although of course there are both rounding and noise present in practice.

scharfis_brain
29th June 2005, 19:44
mgm262, the original fields are looking like this:

A = F0
B = F1
C = F1
D = 0.66*F1+0.33*F2
E = 0.33*F1+0.66*F2
F = F2
G = F3
H = F3
I = 0.66*F3+0.33*F4
J = 0.33*F3+0.66*F4
K = F4
[....]

my script selects:
F0 - A_deinterlaced
F1 - B+C_weaved
F2 - E_deinterlaced
F3 - G+H_weaved
F4 - K_deinterlaced
[....]

yantei
30th June 2005, 08:26
Big Thanks, scharfis_brain

It worked for the sample, using indicated offset (1). Frames are not clean, but the motion is smooth - that's the most important.
Now I'm trying to write a script which would call the function with another offset automatically. I want to restore progressive frames from the whole movie. I believe it is possible, although hard to develope...

thanks again for Your help

yantei
30th June 2005, 09:03
WOW

One offset of 4 worked for the whole movie!

scharfis_brain, maybe You should 'publish' the script? probably more dvds are telecined this way? (mine is from Hong Kong)