Your finished MP4 plays from disk, but someone opening the same family recording on your website waits at a blank player. Check where the file keeps its playback index before spending another evening encoding it. For an ordinary, self-contained MP4, moving the index ahead of the media lets a player read it early during a progressive download.
Find out whether fast start can help
Work on a copy of the complete file. In a regular MP4, the moov box holds the information the player uses to locate samples. The mdat box contains the media data. With the index at the end, a player may need to fetch bytes from the end or wait for more of the download. FFmpeg’s MP4 muxer can place that index near the start in a second pass. FFmpeg MP4 format documentation
For a local inspection, run:
ffprobe -v trace input.mp4
In our Windows build, the top-level box lines contained parent:'root'. Find those lines for moov and mdat and read them in order. Trace wording varies by build.
| What you find | Next step |
|---|---|
The complete file opens, and the first mdat precedes moov. |
Make a fast-start viewing copy. Keep the original for comparison. |
moov already precedes the media. |
Check the actual hosted file, player and network response. Repeating the same remux offers no further index move. |
FFmpeg reports moov atom not found and cannot open the file. |
Check that the export finished, or retrieve a complete copy. Fast start requires a readable index. |
The trace shows top-level moof boxes. |
This is a fragmented layout. The ordinary MP4 fast-start procedure below targets a different layout. |
Make a viewing copy with the tracks you intended
For a home recording with one video and one audio track, run this from the directory containing the file. Choose a fresh output name:
ffmpeg -n -i input.mp4 -map 0:v:0 -map "0:a:0?" -c copy -movflags +faststart web-copy.mp4
-n protects an existing destination. This command takes the first video and the first audio if present. -c copy copies the selected streams without a new encode. The MP4 container is rewritten. If your source has commentary, a second language, subtitles or other tracks you want, list them first and explicitly select the ones for the viewing copy. For example, ffprobe -v error -show_streams input.mp4 lists each stream’s index and type. An index of 2 in input zero is selected with -map 0:2. Check that each selected stream can be written to MP4. FFmpeg stream copying and selection
What changed in a five-second file
We generated a 320 × 180 H.264 clip at 24 fps with one AAC tone. We ran the command above using FFmpeg and ffprobe build N-100410-gcd821c18dc (2020). These are zero-based byte offsets read from top-level box headers:
| File | Start of moov | Start of mdat | File size |
|---|---|---|---|
| Source | 188,283 | 40 | 193,116 bytes |
| Fast-start copy | 32 | 4,873 | 193,116 bytes |
The files had different SHA-256 hashes. Within each selected stream, the ordered payload hashes matched across all 120 video packets and 236 audio packets. The index moved and the selected encoded media survived. The matching file sizes were specific to this sample.
Repeat the trace on your output and check its track list. Then open the new file at the URL your viewer will use. If playback is still slow with the index at the front, check whether the request is receiving the new file and whether it is slow to receive the first bytes. Compare playback in the intended browser, including sound and seeking. If the player cannot decode the video and audio formats you chose, rearranging the file leaves those formats unchanged.
If your camera split the recording across several files, compare and join the MP4 clips before preparing the web copy.