ffmpeg comes with a tool to re-order the MP4 “atoms” (Seriously don’t ask what are MP4 atoms it’s geek for the sake of geek).

find the file in ffmpeg_src/tools/qt-faststart.c

compile with gcc


gcc qt-faststart.c -o qt-faststart

And run.


/path/to/qt-faststart /path/to/src_vid.mp4 /path/to/output.mp4

NOTE: This only seems to work for h264 encoded videos (libx264).

Tags: ,
3 Responses to “ffmpeg MP4 does not stream qt-faststart”
  1. Stephen Dewey says:

    Actually, you should probably use make to compile this, rather than invoking gcc directly. Here is the header from qt-faststart.c :

    /*
    * qt-faststart.c, v0.1
    * by Mike Melanson (melanson@pcisys.net)
    * This file is placed in the public domain. Use the program however you
    * see fit.
    *
    * This utility rearranges a Quicktime file such that the moov atom
    * is in front of the data, thus facilitating network streaming.
    *
    * To compile this program, start from the base directory from which you
    * are building FFmpeg and type:
    * make tools/qt-faststart
    * The qt-faststart program will be built in the tools/ directory. If you
    * do not build the program in this manner, correct results are not
    * guaranteed, particularly on 64-bit platforms.
    * Invoke the program with:
    * qt-faststart
    *
    * Notes: Quicktime files can come in many configurations of top-level
    * atoms. This utility stipulates that the very last atom in the file needs
    * to be a moov atom. When given such a file, this utility will rearrange
    * the top-level atoms by shifting the moov atom from the back of the file
    * to the front, and patch the chunk offsets along the way. This utility
    * presently only operates on uncompressed moov atoms.
    */

  2. Thanks for that Stephen, I will certainly check this out once I get my new server online :-)

    Cheers

    Buzz

  3. I compiled it via GCC and it ended up crashing my server or it just did nothing that way
    installing it via
    make tools/qt-faststart
    did the trick ^^

Leave a Reply