5

Can one "dump"/extract the MOOV atom from an MP4 file? If so, how? Hoping for an obscure FFMPEG command.

I need to be able to process/play a stream without searching for the MOOV atom over and over again. For very long streams, this can run into several megabytes of data. It's rather strange, I don't think the MOOV atom is huge, I just think that it is scattered thruout the first N megabytes (i.e. toplevel data at the begnning, with references to further atoms that are later in the stream).

Thus, it would make sense for me to extract the MOOV atom out of the file, keep it

5

You can use AtomicParsley to parse the metadata of a MP4-file. For example

 AtomicParsley /path/to.mp4 -T 1

will print the whole atom tree.

4

Maybe I'm a bit late, but I'd use bento4 mp4dump, it's really easy to install on mac with brew brew install bento4

mp4dump 1.mp4 

[ftyp] size=8+16
  major_brand = iso5
  minor_version = 200
  compatible_brand = iso6
  compatible_brand = mp41
[moov] size=8+740
  [mvhd] size=12+96
    timescale = 1000
    duration = 0
    duration(ms) = 0
....
3

You can also use qtfaststart -l fileName which outputs something more human readable like :

$ qtfaststart -l myFile.mp4
ftyp (32 bytes)
free (8 bytes)
mdat (283805466 bytes)
moov (3541465 bytes)

The Python qtfaststart is different from the qt-faststart binary (bundled with ffmpeg) and can be installed using this command:

sudo -H $(which pip) install qtfaststart

qtfaststart command line arguments :

$ qtfaststart -h
Usage: qtfaststart [options] infile [outfile]

Options:
  --version     show program's version number and exit
  -h, --help    show this help message and exit
  -d, --debug   Enable debug output
  -l, --list    List top level atoms
  -s, --sample  Create a small sample of the input file

The qtfaststart sources are here

  • On my Mac, where I get all these nifty utilities with brew, the command is actually qt-faststart and is part of the ffmpeg package. – Gwyneth Llewelyn Oct 22 at 17:00
  • 1
    @GwynethLlewelyn qt-faststart is a binary program but qtfaststart is a Python program, they have different command line arguments. I don't a Mac at hand so I cannot help you anyfurther than this or with brew-pip – SebMa Oct 23 at 11:54
  • Thanks so much, @SebMa, you're quite right — there is indeed a difference — but unfortunately brew and brew-pip don't seem to like qtfaststart; apparently, there is a conflict somewhere between the brew-provided package, and the package provided by pip itself (i.e. brew believes both to be the same). easy_install qtfaststart will work with the system's Python (2.7.X in macOS Catalina). – Gwyneth Llewelyn Nov 26 at 22:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.