The Complete Formats Guide gave you the "what"—this guide gives you the "how" at the deepest level. Every container has private muxer flags. For MP4/MOV, they're bundled under -movflags; for MKV/WebM, they're separate options; and for image/splitting, there are dedicated muxers like image2 and segment.
Key takeaways
- `-movflags` controls MP4/MOV writing (faststart, brand, editlist, timecode, DASH).
- `-brand` sets the `major_brand` (e.g., `mp42`, `isom`) for better compatibility.
- `use_editlist=0` can fix playback timing issues in MP4 files.
- `+frag_keyframe` + `+empty_moov` creates fragmented MP4 for DASH/HLS.
- MKV offers `reserve_index_space`, `cues_to_front`, and `cluster_size_limit`.
- `image2` muxer exports frame sequences; `segment` muxer splits files.
MP4 / MOV – mastering `-movflags`
The -movflags option takes a colon‑separated or plus‑separated list of flags. These control the structure of your MP4/MOV file.
1. `faststart` (web streaming)
We covered this in the basics, but let's reinforce it: it moves the 'moov' atom to the beginning of the file.
ffmpeg -i input.mp4 -c copy -movflags +faststart output.mp4
2. Setting the brand (`-brand` and `-compat_brand`)
The brand (or `major_brand`) tells players what standard the file conforms to. Common brands:
- `isom` – ISO base media file format (most compatible).
- `mp42` – MP4 v2 (better for modern players).
- `avc1` – H.264 with AVC structure (often required for web).
- `hev1` – H.265/HEVC.
- `M4A` – Audio‑only MP4 (for iTunes/Apple).
ffmpeg -i input.mov -c copy -brand mp42 -compat_brand isom,avc1 output.mp4
3. Edit lists (`use_editlist`, `write_colr`, `write_tmcd`)
- `use_editlist=0` – Disables the edit list. Edit lists tell players to skip frames (e.g., for trimming). Some players ignore them, causing sync issues. Set this to 0 if your video starts at a wrong time in QuickTime/VLC.
- `write_colr=1` – Writes colour information (matrix, transfer, primaries) to the MP4 header. Essential for HDR content.
- `write_tmcd=1` – Writes a timecode track (SMPTE TC). Required for professional editing workflows.
ffmpeg -i input.mov -c copy \ -movflags use_editlist=0+write_colr=1+write_tmcd=1 \ -brand mp42 output.mp4
4. Fragmented MP4 for DASH / HLS
Adaptive streaming requires fragmented MP4 (where the file is split into tiny chunks). Use these flags together:
- `+frag_keyframe` – starts a new fragment at each keyframe.
- `+empty_moov` – writes a minimal 'moov' atom at the start (the rest of the metadata is in the fragments).
- `+separate_moof` – separates the movie fragment and its index.
- `+default_base_moof` – uses a default base offset for fragments.
# Fragmented MP4 for DASH/HLS ffmpeg -i input.mov -c copy -movflags +frag_keyframe+empty_moov+default_base_moof output.mp4
For DASH manifest generation, you'll also use -f dash separately.
MKV / WebM – Matroska muxer options
The matroska muxer (used for both `.mkv` and `.webm`) offers several tuning options for large files and streaming.
# Optimise MKV for fast seeking ffmpeg -i input.mov -c copy -reserve_index_space 1M -cues_to_front 1 output.mkv
- `-reserve_index_space` – Reserves space at the start of the file for the index (cues). Makes seeking faster. Use
1M(1 megabyte) or512K. - `-cues_to_front` – Moves the cue index to the front of the file. Essential for streaming and fast seeking.
- `-cluster_size_limit` – Max size of a cluster in bytes (default ~5MB). Smaller clusters = better seeking but larger file overhead.
- `-default_mode` – Controls default track flags (can be used to set which audio/subtitle track plays by default).
For WebM, the same options apply, but you may also use -dash 1 to write a WebM file compatible with DASH.
Image sequences – the `image2` muxer
Exporting a video as a sequence of images (or importing one) is a common task. The image2 muxer handles this.
Exporting frames to PNG/JPEG
# Export every 10th frame as JPEG ffmpeg -i input.mov -vf "fps=1" -frame_pts 1 -start_number 0 -update 0 output_%05d.jpg # Export all frames as PNG with a custom range ffmpeg -i input.mov -frames:v 100 -start_number 100 image_%04d.png
- `-start_number` – The number for the first filename.
- `-frames:v` – Total number of frames to write.
- `-update` – If set to 1, updates the same file (useful for thumbnails).
- `-frame_pts` – Uses the presentation timestamp for the filename.
Importing an image sequence
ffmpeg -framerate 24 -i frame_%04d.png -c:v libx264 -crf 18 output.mp4
The Segment muxer – splitting files
We touched on this in the trimming guide, but let's cover the full options.
ffmpeg -i input.mp4 -c copy -f segment \ -segment_time 600 -segment_list list.csv \ -segment_format mp4 -reset_timestamps 1 \ part_%03d.mp4
- `-segment_time` – Duration of each segment in seconds.
- `-segment_list` – Writes a file containing the list of segment names (useful for HLS playlists).
- `-segment_format` – Forces a specific container format for the segments (e.g., `mp4`, `mpegts`).
- `-reset_timestamps` – Resets timestamps to 0 at the start of each segment. Essential for playlists.
- `-break_non_keyframes` – Forces a segment break at non‑keyframes (can cause technical issues, use with caution).
Muxer flags cheat sheet
| Container | Flag / Option | Use case |
|---|---|---|
| MP4 | -movflags +faststart | Web streaming (move moov to front) |
| MP4 | -brand mp42 -compat_brand isom,avc1 | Better player compatibility |
| MP4 | -movflags use_editlist=0 | Fix start‑time issues in QuickTime |
| MP4 | -movflags +frag_keyframe+empty_moov | Fragmented MP4 for DASH/HLS |
| MKV | -reserve_index_space 1M -cues_to_front 1 | Fast seeking in large MKV files |
| Image2 | -start_number 0 -frames:v 50 | Export frame range |
| Segment | -segment_time 600 -reset_timestamps 1 | Split into 10‑minute chunks |
Combine these advanced muxer flags with the Advanced Codec Options to build truly professional, broadcast‑ready files without re‑encoding.