Using FFmpeg to locate moov atom
FFmpeg won't show you this information, really.
You could use AtomicParsley to parse the file, e.g.:
AtomicParsley input.mp4 -T
This will show you the location of the atoms in a tree. If the moov
atom is at the beginning of the file, it'll have to come right after the ftyp
atom, so you could try parsing the output, e.g. in Bash, only printing the second line and checking whether it contains moov
:
AtomicParsley input.mp4 -T | sed -n 2p | grep -q "moov" && echo "yup" || echo "nope"
Using this qtfaststart
(not the same as ffmpeg's qt-faststart
), qtfaststart
-l
input.mp4 will display the order of the top-level atoms.
$ qtfaststart -l bad.mp4
ftyp (32 bytes)
free (8 bytes)
mdat (559619 bytes)
moov (52916 bytes)
$ qtfaststart -l good.mp4
ftyp (32 bytes)
moov (52916 bytes)
mdat (559619 bytes)
$
The way to do this using ffmpeg
is described in this answer to another question. Run the following Bash command:
$ ffmpeg -v trace -i file.mp4 2>&1 | grep -e type:\'mdat\' -e type:\'moov\'
The output will look something like this:
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55ea95500ac0] type:'mdat' parent:'root' sz: 52958326 32 52971704
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55ea95500ac0] type:'moov' parent:'root' sz: 13354 52958358 52971704
In this example, since moov
appears after mdat
, the moov atom is not at the beginning of the file and faststart is not enabled. If moov
were to appear before mdat
, then the moov atom would be at the beginning of the file and faststart would be enabled.