[FFmpeg-devel] [RFC] interlace flagging and detecting.

Tim Nicholson nichot20 at yahoo.com
Tue Oct 9 16:52:50 CEST 2012


I am trying to tie up some loose ends in the interlace flagging within
ffmpeg brought to light by attempting to sort out the missing, but
mandatory 'fiel' atom in uncompressed quicktimes.

I could do with some confirmation from those more familiar that I am on
the right track.

>From what I have gleaned by poring over the code, ffmpeg and libraries
principally use the AVFrame struct 'interlaced_frame' and
'top_field_first' flags, although there is also AVCodecContext's
field_order enum which seems to exist in order to cover the flag
permutations required by the qt fiel atom. AFAIK currently these two are
completely independent. I can find no code to link them or use one if
the other is blank.

For example, a sample uncompressed 2vuy .mov when inspected by 'ffprobe
-show_frames' has interlaced_frame and top_field_first = 0 whilst the
'fiel' atom indicates interlaced/bottom field first.

I have tried forcing interlace flagging using c.f.

ffmpeg -i short_UNCOMPRESSED.mov -c rawvideo -pix_fmt uyvy422 -an  -vtag
2vuy -vf "setfield=tff" short_raw-set_field.mov

but was surprised to find that ffprobe also considered this to have
interlaced_frame and top_field_first = 0, is this because the
information is not actually embedded in the stream but only exists
within ffmpeg internally?

Trying to set AVCodecContext's 'field_order' from AVFrame's
'interlaced_frame' etc by means of sniffing an AVStream's
codec->coded_frame->interlaced_frame and then setting codec->field_order
does not yet work for me as 'interlaced_frame' may be unset (or seems to
be at the point I was trying, since as it is set per frame I presume its
only valid after frames have been processed).

I notice also that although many codecs seems to access the AVFrame
'interlaced_frame' for making decisions about interlace handling the
Avid Meridien coder (avuienc.c) specifically uses AVCodecContext's
field_order, so there does seem to be some inconsistency.


Feel free to point out how completely I am missing things, as if I get
to understand it, there's more chance of a proper solution to the
initial problem, and maybe some other benefits on the way..
-- 
Tim



More information about the ffmpeg-devel mailing list