Back

Blog details

MPEG-TS vs fMP4 for HLS Segments and When to Use Each

AIOZ Network
7 min readNovember 17, 2026
aioz-stream
AIOZ Stream knowledge hub cover with the headline MPEG TS vs fMP4 for HLS Segments

MPEG-TS vs fMP4 is the choice of container for each HLS segment. MPEG-TS cuts audio and video into 188-byte packets that every segment carries on its own, while fMP4 stores them in ISO boxes behind one shared init segment. For new HEVC, AV1 or CMAF work, pick fMP4.

TL;DR:

  • Both are segment containers inside HLS, so switching changes the wrapper and two playlist lines while the codec stays the same.
  • MPEG-TS repeats its PAT and PMT tables in every segment; fMP4 keeps track setup in one init segment named by EXT-X-MAP.
  • In our FFmpeg test, the same streams took 3.4% more bytes as MPEG-TS at 720p and 8.9% more at 360p.
  • Apple requires fMP4 for HEVC and AV1 in HLS; H.264 works in either container.
  • On AIOZ Stream you pick container_type per quality: mpegts or mp4 for HLS, fmp4 for DASH.

What is the difference between MPEG-TS and fMP4?

Both formats wrap the same compressed video and audio, so switching between them never touches picture quality, as our guide to how video encoding, codecs and containers fit together explains.

MPEG-TS (MPEG-2 Transport Stream, ISO/IEC 13818-1) was built for broadcast TV. It slices every stream into fixed 188-byte packets, each starting with the sync byte 0x47 and carrying a packet ID (PID). Two small tables, the Program Association Table (PAT) and the Program Map Table (PMT), tell a decoder which PID holds what. RFC 8216 says each Transport Stream segment must contain a PAT and a PMT unless an EXT-X-MAP tag supplies them, so in practice every .ts file you download decodes on its own.

Fragmented MP4 is built on the ISO Base Media File Format. A normal MP4 keeps one large index, the moov box, for the whole file, which suits the MP4, MOV, WebM and MKV files you edit but not a stream. The fragmented form moves track and codec setup into a small initialization segment, an ftyp box plus a moov with zero samples. Media then arrives as moof and mdat pairs, and each moof indexes only its own samples. RFC 8216 requires every fMP4 segment in a media playlist to have an EXT-X-MAP tag pointing at that init segment.

Diagram comparing one HLS rendition packaged two ways. Left, MPEG-TS: a version 3 media playlist points to seg_000.ts, which holds 12,953 packets of 188 bytes, with PAT and PMT tables repeated 3 times, 12,387 video packets and 559 audio packets; 10 segments total 24,264,408 bytes. Right, fMP4: a version 7 playlist with an EXT-X-MAP tag points to init.mp4 (ftyp and moov, 1,373 bytes, loaded once) and to seg_000.m4s, made of styp, two sidx boxes, a 3,456-byte moof and a 2,351,509-byte mdat; init plus 10 segments total 23,476,107 bytes. MPEG-TS is 3.4% larger at 720p and 8.9% larger at 360p.
The same 720p rendition as MPEG-TS and as fMP4. Every number comes from our FFmpeg run described below.

When we ran ffprobe on a lone fMP4 media segment, it stopped with "trun track id unknown, no tfhd was found", while the same command on a lone .ts segment listed h264 and aac.

What changes in the HLS playlist

We packaged a 60-second H.264 and AAC test pattern twice with stream copy, so nothing was re-encoded, using FFmpeg 7.0.2 here on 2026-10-29 (logging flags trimmed):

ffmpeg -i src-720p.mp4 -c copy -f hls -hls_time 6 -hls_playlist_type vod \
  -hls_segment_type mpegts -hls_segment_filename 'ts-720p/seg_%03d.ts' ts-720p/index.m3u8

ffmpeg -i src-720p.mp4 -c copy -f hls -hls_time 6 -hls_playlist_type vod \
  -hls_segment_type fmp4 -hls_fmp4_init_filename init.mp4 \
  -hls_segment_filename 'fm-720p/seg_%03d.m4s' fm-720p/index.m3u8

The first lines of the two media playlists it wrote:

# ts-720p/index.m3u8          # fm-720p/index.m3u8
#EXTM3U                       #EXTM3U
#EXT-X-VERSION:3              #EXT-X-VERSION:7
#EXT-X-TARGETDURATION:6       #EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:0       #EXT-X-MEDIA-SEQUENCE:0
#EXT-X-PLAYLIST-TYPE:VOD      #EXT-X-PLAYLIST-TYPE:VOD
#EXTINF:6.000000,             #EXT-X-MAP:URI="init.mp4"
seg_000.ts                    #EXTINF:6.000000,
                              seg_000.m4s

The fMP4 playlist adds #EXT-X-MAP:URI="init.mp4", and its compatibility version rises from 3 to 7. RFC 8216 requires version 6 or higher whenever EXT-X-MAP appears in a normal media playlist, so your player must support that version, and the rest works as our guide to M3U8 files and HLS segmentation describes.

If you add HEVC later, also check the codec tag in the init segment, because Apple's rule 1.10 prefers hvc1 and avc1 over hev1 and avc3. Our H.264 init segment passed:

$ ffprobe -v error -show_entries stream=codec_name,codec_tag_string -of csv=p=0 fm-720p/init.mp4
h264,avc1
aac,mp4a

How much overhead does MPEG-TS add?

We repeated the test at a low rung to see how the gap moves with bitrate, with identical streams in ten 6-second segments each:

RenditionMPEG-TS bytesfMP4 bytes (init + segments)MPEG-TS extra
720p, 3 Mbit/s video, 128 kbit/s AAC24,264,40823,476,107+3.4%
360p, 400 kbit/s video, 64 kbit/s AAC3,842,1563,528,892+8.9%

To see why the gap grows, we parsed every packet with a short Python script. The 4-byte packet headers cost 2.13% at both rates, the floor that 4 out of 188 bytes sets. The rest is padding, because a new PES unit has to start at the beginning of a packet and the last packet of each frame gets filled out with stuffing. At 720p those adaptation fields took 0.94% of the bytes, but at 360p, where a 30 fps frame averages about 1,700 bytes, they took 4.95%.

So MPEG-TS costs the most on the small rungs your viewers on weak connections fall back to. Fora Soft's audio math agrees, with at least 4.2% packaging for 128 kbit/s AAC in MPEG-TS against about 1.2% in fMP4, but treat our run as one synthetic sample and measure your own titles.

When should you use MPEG-TS vs fMP4?

Apple's HLS authoring specification settles most cases through the codec. Rule 1.2 allows H.264 in fMP4 or MPEG transport streams, rule 1.5 requires fMP4 for HEVC, and rule 1.39, added on 2025-06-24, requires fMP4 for AV1. So check how H.264, H.265 and VP9 compare and whether AV1 fits your audience first.

Choose fMP4 when:

  • You add HEVC or AV1 renditions, because Apple devices won't play them from .ts segments.
  • You want one set of segments for HLS and DASH, since CMAF segments are fMP4 (see our HLS vs MPEG-DASH comparison).
  • You plan DRM: RFC 8216 encrypts SAMPLE-AES fMP4 segments with the cbcs scheme, so one set can serve FairPlay, Widevine and PlayReady.
  • Most viewers use hls.js, whose README says fMP4 passes straight to Media Source Extensions while MPEG-TS is transmuxed into fMP4 in the browser first.

Keep MPEG-TS when:

  • Your player fleet includes devices older than fMP4 support in HLS, which Apple added to its authoring spec on 2016-09-13.
  • You serve iOS over cellular, where Apple's iOS rule 9.22 still says a peak 192 kbit/s H.264 variant "packaged in a transport stream SHOULD be provided".
  • Your segments feed broadcast or contribution gear that expects transport streams.

Latency isn't a reason to switch on its own, because segment and part durations set most of the delay, as our Low-Latency HLS guide explains. For the wider picture, see our overview of streaming protocols and the video streaming glossary entries for PES, PMT and CMAF.

How AIOZ Stream handles it

When you create a video, each entry in qualities sets a resolution, a type and a container_type. The Video API reference says: "For hls, container_type supports mpegts or mp4. For dash, container_type supports fmp4." The same page notes that on Safari, iOS and tvOS, HLS plays HEVC only from fMP4/CMAF segments, while H.264 works with both. We encode H.264 up to 4K and H.265 up to 8K with AAC audio, so our reading is that an H.265 HLS quality should use mp4, not mpegts.

Here is the reference's example configuration, trimmed to one rendition and not run here, since this machine has no AIOZ credentials:

{
  "title": "My Video",
  "type": "video",
  "qualities": [
    {
      "resolution": "1080p",
      "type": "hls",
      "container_type": "mpegts",
      "video_config": { "codec": "h264", "bitrate": 5000000, "index": 0 },
      "audio_config": { "codec": "aac", "bitrate": 192000, "channels": "2",
                        "sample_rate": 48000, "language": "en", "index": 0 }
    }
  ]
}

Live sessions take a qualities array that the docs describe as similar to video creation, and the live streaming API's example requests HLS with mpegts. If you already have an HLS library, the M3U8 import accepts both MPEG-TS and fMP4 segments, with at most one EXT-X-MAP per variant. The docs don't state our segment duration or whether the HLS mp4 option writes CMAF-branded fragments.

Next step: set container_type per quality in the AIOZ Stream Video API reference.

FAQ

Is fMP4 better than MPEG-TS for HLS?
For a new ladder with HEVC, AV1, DRM or shared DASH segments, yes, while MPEG-TS stays the safe default for H.264-only reach to old devices.

Does switching from MPEG-TS to fMP4 mean re-encoding?
No, because a container change with the same codec is a repackage, which is what -c copy did in our test.

What is the .m4s file in an HLS playlist?
It's an fMP4 media segment, and a player can only parse it after loading the init segment named in EXT-X-MAP.

Can HEVC go in MPEG-TS segments?
The transport stream format can carry HEVC, but Apple's rule 1.5 requires fMP4 for HEVC in HLS, and the AIOZ Stream docs say Apple platforms don't play HEVC from MPEG-TS.

References

We only send updates when meaningful changes ship, and you can unsubscribe anytime

Related Content

blog thumbnail

Restream to Multiple Platforms With AIOZ Stream Multicast

Restream to multiple platforms by sending one feed to a relay. Learn the bandwidth math, platform rules and how AIOZ Stream multicast forwards your RTMP stream.

aioz-stream
6 min readNovember 20, 2026
blog thumbnail

MPEG-TS vs fMP4 for HLS Segments and When to Use Each

MPEG-TS vs fMP4 for HLS: how 188-byte TS packets and fMP4 init segments differ, what each costs in overhead, which codecs need fMP4, and when TS still fits.

aioz-stream
7 min readNovember 17, 2026
blog thumbnail

Live Streaming vs VOD (Video on Demand) and When to Use Each

Live streaming vs VOD comes down to when your audience watches. Three questions help you pick live, on demand or both, with real costs and AIOZ Stream limits.

aioz-streamguide
6 min readNovember 13, 2026
blog thumbnail

How Does Live Streaming Work? From Encoder to Viewer

How does live streaming work? Video is captured, encoded, sent over RTMP, transcoded, cut into HLS segments and served to players. See each stage end to end.

aioz-streamguide
7 min readNovember 12, 2026
blog thumbnail

How Web Video Players Work: HTML5 Video, MSE and EME

How web video players work: the HTML5 video element plays media, MSE lets JavaScript feed it HLS and DASH segments, and EME unlocks DRM-protected streams.

aioz-streamguide
7 min readNovember 11, 2026
blog thumbnail

SRT vs VTT Subtitle Formats and When to Use Each One

SRT vs VTT explained: how the two subtitle formats differ in timestamps, headers and styling, which one browsers, HLS and YouTube expect, and how to convert.

aioz-stream
6 min readNovember 10, 2026