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

Tim Nicholson nichot20 at yahoo.com
Fri Oct 26 12:24:41 CEST 2012

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.


More information about the ffmpeg-devel mailing list