AROUND / EDITORIAL
MP4, Fragmented MP4 or MPEG-TS? Choosing the Right Format for Live Recording and Clipping

A live production team wants to watch a feed, cut a highlight before the event ends, and retain a recording for later editing. These are three different access patterns. Treating them as one file-format problem can lead to unnecessary encoding, duplicate storage or difficult recovery after a failure.
Before adding another processing service, ask: do we need another encoded video, or just another way to access the same encoded video?
1. Separate codecs, containers and delivery
H.264 and AAC are codecs. MP4 and MPEG-TS are containers. HTTP Live Streaming (HLS) is a delivery protocol. A conventional MP4 is convenient for completed recordings, but its index is typically finalized at close. Fragmented MP4 distributes sample information across fragments, which can improve recovery after interruption. MPEG-TS is packet-oriented and useful for continuous ingest. HLS can deliver TS or properly packaged fMP4 segments; a growing file alone is not a valid HLS presentation. See RFC 8216 and FFmpeg’s fragmentation documentation.
2. Choose the format for the job
MP4: finished clips, downloads and editing interchange. Validate NLE compatibility and successful finalization.
fMP4: continuous recording and rolling storage. Test fragment recovery, seeking and editor compatibility.
MPEG-TS: continuous broadcast ingest. Check timestamp discontinuities, audio mapping and clip extraction.
HLS: live and on-demand viewing. Design playlist lifecycle, player compatibility and retention independently.
3. Start with one encoding, not necessarily one physical file
Feed recording and live packaging from the same encoded input where possible. Maintain a timeline index for resolving clip requests. Remux when the destination accepts the original codec, bitrate and GOP structure; transcode when a different rendition, overlay or exact cut requires it. Shared encoding does not eliminate I/O, packaging or storage costs.
The open-source MediaMTX project supports fMP4 and MPEG-TS recording and time-range playback. Evaluate these capabilities against your actual editing and delivery requirements.
4. Try a remux experiment
Use a completed MP4 containing one H.264 video track and one AAC audio track. Run these commands in a scratch directory with FFmpeg and ffprobe installed. This example selects only the first video and audio tracks; it is not a preservation-grade conversion.
ffmpeg -i sample.mp4 -map 0:v:0 -map 0:a:0 -c copy -f mpegts sample.ts
ffmpeg -i sample.ts -map 0:v:0 -map 0:a:0 -c copy -movflags +faststart roundtrip.mp4
ffprobe -v error -show_streams -show_format -of json roundtrip.mp4
FFmpeg’s stream copying avoids decoding and re-encoding. Compare duration, sync, codec parameters and playback. Do not expect identical timestamps, files or metadata. Captions, timecode, alternative audio and external metadata need separate checks.
5. Seven checks before changing production
1. Compatibility: verify playback, scrubbing, clip export and downstream ingest.
2. Recovery: interrupt test recordings and measure recoverable duration.
3. Time alignment: request clips across segment boundaries and verify sync and frame boundaries.
4. Metadata: inventory audio tracks, captions, timecode and external relationships before and after packaging.
5. Performance: compare CPU/GPU usage, written and stored bytes, network traffic and clip delivery time.
6. Retention: ensure expired live segments cannot remove the only copy required for editing or archive.
7. Fallback: retain the existing path until the replacement passes acceptance and recovery tests.
The engineering decision
If duplicated encoding is the bottleneck, evaluate shared encoded inputs or stream copying. If duplicated storage is the problem, investigate whether recording fragments can also serve delivery under your retention and access requirements. These are different optimizations.
A single physical file is not the goal in itself. The goal is a reliable workflow that preserves the source, gives operators fast timeline access and performs expensive processing only when required.
