[MPlayer-users] Telecined video questions

Ville Saari 113762 at foo.bar.org
Thu Mar 25 21:13:56 CET 2004


On Wed, Mar 24, 2004 at 09:38:37PM -0500, D Richard Felker III wrote:

> > I've recorded an mpeg2 stream from a DVB, a cartoon, which is telecined, 
> > and it's in PAL.
> 
> It's hard to know what the hell was done to it, if it's PAL and
> telecined. Probably a bad NTSC->PAL conversion post-telecine that will

If it's PAL and shows interlacing, then I'd say that it's much more likely
that it just has the field phase mismatch I described earlier:

Original progressive frames:      | t0  | t1  | t2  | t3  | t4  | t5  |
                                  | b0  | b1  | b2  | b3  | b4  | b5  |

Converted to interlaced fields:   |t0|  |t1|  |t2|  |t3|  |t4|  |t5|  |
                                  |  |b0|  |b1|  |b2|  |b3|  |b4|  |b5|

Then mispaired to mpeg frames: |   t0|   t1|   t2|   t3|   t4|   t5|   ..|
                               |..   |b0   |b1   |b2   |b3   |b4   |b5   |

As you can see (if you read this with monospaced font) the frame boundaries
have shifted in time. The articicial field boundary in the middle of the
original frame has become the frame boundary.

If the phase error stays constant through the whole movie, then the
theoretical way to fix it would be to first separate frames into fields
with tfields filter, then skip the first field and then join the fields
back into frames with tinterlace. But there's no way to skip the first
frame in the middle of the filter chain and tfields and tinterlace
don't let you select the desired field order.

And in real life the solution wouldn't be that simple anyway. Usually parts
of the movie are ok and other parts appear interlaced because the field
phase changes every now and then.

Based on what the mplayer manpage says, ivtc and filmdint filters should
both be able to hande this situation, but they don't.

When I faced this problem, I was desperate enough to write my own filter
to handle it. The code is quite hackish and its sloooow, but it works -
most of the time. My algorithm is this:

  I consider three different field pairings for each frame:

  - top and bottom fields of the current frame
  - top field of the previous frame and the bottom from the current
  - top from the current and the bottom from the previous

  And I output which ever of the three is the best match.

It also has options to disable some of the alternatives to speed up the
comparison and prevent bogus matches. For example if I know that the entire
file is like the example above, then only the second alternative is needed
and the filter doesn't need to compare anything. Or when I capture analog
source with my DV-camcorder, all I need are the first and second
alternatives. The third case is impossible, because the camcorder always
captures bottom field first.

I haven't published the source for the filter because I was somewhat shy of
the hackish quality of the code, but I might if someone expresses interest.

-- 
 Ville




More information about the MPlayer-users mailing list