[FFmpeg-devel] [PATCH] movenc: enable writing of interlace information back to the 'fiel' atom. (2nd Version)

Robert Krüger krueger at lesspain.de
Fri Oct 26 16:36:31 CEST 2012

On Fri, Oct 26, 2012 at 12:24 PM, Tim Nicholson <nichot20 at yahoo.com> wrote:
> I hope the following patchset address the concerns previously expressed.
> For each coder for which the 'feil' atom is relevant the coder init
> function makes an initial setting to indicate that interlace coding is
> being performed. However until an incoming AVFrame is presented to the
> coder there is no way of know if the material is tff or bff. Therefore
> iff the mov muxer finds that the field_order flag indicates interlace it
> checks the top_field_first flag and adjusts the field_order accordingly.
> In the case of a stream copy 'track->enc->coded_frame' is NULL and the
> code is ignored.
> In the case when an encode thread finishes before the muxer, the code
> will still work because the coder close functions are only called by
> ffmpeg after any output files are closed (see the transcode() function).
> If the code was in the encoder close function it would update the values
> after they had been written to file.
> The only alternative I can see to this approach is to continuously set
> the value of the AVCodecContext->field_order in the coders encode
> function. Constantly setting something to the same value for every frame
> coded does not feel like a good idea.
> The 'fiel' atom will only be written for codecs which specifically set
> up the field_order initially, avoiding the chance of incorrect values
> for other codecs (another concern).
> Other codecs that need the 'fiel' atom setting can be added by a simple
> addition to their init function.

I just ran into an issue with ffmbc that makes me believe that maybe
Final Cut 7 needs the fiel atom set to work properly even for codecs
where it is not mandatory. If you're interested in this see

It would be good to get a second opinion on this.

More information about the ffmpeg-devel mailing list