[FFmpeg-user] Any way to estimate moov_size in mov/mp4?

Stefan Oltmanns stefan-oltmanns at gmx.net
Sun Feb 12 16:32:38 EET 2023

Am 11.02.23 um 02:14 schrieb Carl Zwanzig:
> In the ffmpeg source it appears to be in libavformat/mov.c and movenc.c,
> but the info actually included will vary with what's being stuffed into
> the container.
That code is a little to complex for me to get any useful information
about the mov format from it (well, except that a lot of codecs seem to
share the same fourCC)

> Sidestepping the question, there are decent write-ups at
> https://atomicparsley.sourceforge.net/mpeg-4files.html
> https://www.cimarronsystems.com/wp-content/uploads/2017/04/Elements-of-the-H.264-VideoAAC-Audio-MP4-Movie-v2_0.pdf
These are really helpful documents!

> And while it's old, you could grab a copy of AtomicParsley and see
> what's in various test files.

The sourceforge page sure is, but there is a fork on GitHub:

It is also included in the Ubuntu repository.

Unfortunately it directly shows an error:

AtomicParsley error: Quicktime movie files are not supported.

For mp4 files it is really nice, but also shows it's a lot more complex
than I expected. Unfortunately AtomicParsley only gives a list of the
atoms and doesn't parse it's contents (for the small information atoms).

What I was able to figure out, by just defining a way to small
moov_size, so ffmpeg teels me how much more space it would have needed:

-For DNXHD every frame uses exactly 4 byte in the moov atom
-For ProRes every frame uses exactly 8 byte in the moov atom
-For AVC all-I it varies between 4 and 5 bytes
-For AVC (default settings) it varies between 12 and 13 bytes

Audio (PCM) is bit more complex, it needs about 208 bytes per second,
sample rate has only little influence. I'm not sure if the variations
are a result of the fact, that ffmpeg maybe doesn't perfectly cut the
audio for some reason (100 video at frames 25fps *should* be exactly
192000 audio samples at 48kHz, but that doesn't work for NTSC frame
rates, so I don't know the logic here).

Best regards

More information about the ffmpeg-user mailing list