[FFmpeg-user] Directly specify MOV atom values through avformat?

Thomas Worth dev at rarevision.com
Mon Dec 12 14:57:32 CET 2011

I am having a little trouble getting MOV output exactly the way I want
it. I have tried different combinations of time_base parameters with
both AVCodecContext and AVStream, but the MOV keeps getting written
with atom values I don't specify. For example, if I force the
time_base of both structs to 1000/25000, my MOV is still written with
an stts duration of 1001 (the input file is 23.976, so I assume that's
where it's coming from). What would be great is if I could just
directly specify these values through avformat. I am doing this now
via my own code that re-writes these values after avformat is
finished, but it would be much more convenient if I could just do this
all through avformat.

Atoms I would like to specify directly:

mvhd (time scale)
tkhd (duration)
mdhd (time scale)
stts (sample duration)

The only thing I seem to be able to specify directly is the mdhd time
scale. That seems to be directly linked to the stream's time_base.

This is probably a Baptiste question, if he's still on this list.

More information about the ffmpeg-user mailing list