[FFmpeg-devel] mpegvideo : interlaced_frame with picture_structure == PICT_FRAME

Hendrik Leppkes h.leppkes at gmail.com
Mon Jan 5 23:21:17 CET 2015

On Mon, Jan 5, 2015 at 9:17 PM, Vanista Herion <vanista at gmail.com> wrote:

> Some MPEG 2 video will give bad interlacing information in AVFrame. If the
> parameters are used by a deinterlace filter such as yadif, frames will be
> processed needlessly and impair the quality.
> By reviewing the code in mpegvideo.c which sets the interlaced_frame
> and top_field_first, I noticed that picture_structure is not considered
> whereas it probably supersedes everything else. The H.262 specification is
> not very clear on that but in the case of this sample, the stream is
> definitely progressive, picture_structure is equal to 3 (Frame picture) and
> top_field_first alternates true and false.
> The result is that frames come out reported as tff, bff and progressive,
> cycling at every frame.
> I propose a simple patch to set interlaced_frame to false when
> picture_structure is equal to PICT_FRAME.
>>  interlaced_flag_switch.mpeg
> <
> https://docs.google.com/file/d/0B72Rmfr6KECZVVE1T3R6dWhMb2s/edit?usp=drive_web
> >

The behaviour on that file is correct as far as I can see.
The file is not progressive, its telecined. Telecined video is coded
partially interlaced (even when the content is not technically interlaced),
and when you treat it as pure progressive you will get artifacts.

I do not think any changes are required.

Someone like kierank can probably explain it better and confirm or deny my

- Hendrik

More information about the ffmpeg-devel mailing list