Fragment MP4 for Streaming
Turn a regular MP4 into a fragmented MP4 with an init header and moof/mdat fragments. Stream-copy by default, or re-encode to H.264/AAC for browser compatibility. Runs locally in your browser.
About this tool
A progressive MP4 usually has one moov index for the whole file. A fragmented MP4 (fMP4) instead starts with a small initialization header and then stores media in moof + mdat fragments. That layout is what Media Source Extensions players, DASH byte-range workflows, and CMAF-style packaging expect.
This tool rewrites a video into a single-file fragmented MP4. In the default copy mode it stream-copies every track with ffmpeg, so there is no quality loss and no re-encode step. If the source codecs are not browser-friendly, switch to h264 mode to re-encode video as H.264/yuv420p and audio as AAC.
Worked example
For an MP4 that already uses browser-compatible codecs, use:
- Conversion mode:
copy - Streaming profile:
MSE / generic fMP4 - Minimum fragment duration:
0 - sidx segment index: off
The ffmpeg plan applies the key flags for a single-file fMP4: keyframe-aligned fragments, an empty initialization moov, and default-base-is-moof offsets. The output remains an .mp4, but it is organized as fragments instead of one progressive media data run.
Limits and edge cases
- The output is one
.mp4file. It does not create an HLS/DASH manifest,init.mp4, or multiple.m4ssegment files. copymode cannot create new keyframes. Fragment boundaries follow the keyframes already in the source. Useh264mode when you need regular 2-second keyframes.fragment_durationis a minimum target in seconds. Fragments stay keyframe-aligned, so exact lengths depend on the encoded keyframes.faststartis not exposed: with an empty initializationmoov, the useful header is already at the front.- A global
sidxis optional because it adds overhead and is mainly useful for byte-range single-file DASH.
FAQ
Is fragmented MP4 the same as moving moov to the front?
No. faststart moves one progressive MP4 index to the beginning. Fragmented MP4 creates an initialization header plus repeated moof/mdat fragments, which is a different container layout for streaming append and byte-range workflows.
Does copy mode reduce quality?
No. Copy mode uses ffmpeg stream copy, so encoded audio and video packets are not decoded or re-encoded. The container is rewritten, but the media quality is unchanged.
When should I use H.264 mode?
Use H.264 mode when the source codec is not accepted by your target browser/player, or when the source has sparse keyframes and you want more regular fragments. It is slower and lossy because it re-encodes the video.
Why are my fragments not exactly the duration I requested?
Fragments are cut on keyframes so each fragment starts at a random-access point. If the source has keyframes every five seconds, copy mode cannot safely produce exact two-second fragments. Re-encode with a two-second keyframe interval if you need that cadence.
Can this create an HLS or DASH manifest?
No. This block returns a single media file, which fits the gizza page and CLI surfaces. Manifest generation and multi-file segment output need a different artifact model.
Developer & Automation Access
Run it from the terminal
Same engine as this page, headless — via the gizza CLI:
gizza tool video-fragmented-mp4 'url=https://example.com/input' 'mode=copy' 'profile=mse' 'keyframe_interval=2' 'segment_index=true'New to the CLI? Get gizza →
Open it by URL
Pre-fill and auto-run this tool with query parameters — the names match the API/CLI:
https://gizza.ai/tools/video-fragmented-mp4/?url=https://example.com/input&mode=copy&profile=mse&keyframe_interval=2&segment_index=trueMachine-readable descriptor: tool.json — title + parameters JSON Schema for agents.
