title: How to output fragmented mp4 with ffmpeg?
body: <p><code>ffmpeg -i infile.avi out.mp4</code> outputs non-fragmented MP4.</p>
  
  <p>How do I obtain fragmented mp4?</p>
  
  <p><strong>Update</strong>
  A fragmented mp4 file is internally divided into several back-to-back chunks or MPEG-4 movie fragments. Each chunk has its own moof atom - so there are several moof atoms interleaved in the file instead of a single moov at the end as in the case of an unfragmented mp4. This makes it easier to stream over slow networks where buffering is involved</p>
  
  <p>There are several tools like <a href="https://gpac.wp.mines-telecom.fr/2011/02/02/mp4box-fragmentation-segmentation-splitting-and-interleaving/" rel="noreferrer">mp4box</a> that convert a normal mp4 to a fragmented one. Unfortunately we cannot use something like this</p>
  
  <pre><code>ffmpeg &lt;options to output mp4&gt; | mp4box
  </code></pre>
  
  <p>since ffmpeg does not produce seekable output while producing mp4 containers.</p>