State of MPEG-TS

Edward Hervey (bilboed)

MPEG 2 Part 1 : Systems

  • July 1995 : Happy 30th anniversary
  • ITU-T H.222.0 == ISO 13818-1
  • MPEG-2 Part 1: Systems
    • Program Stream (DVD)
    • Transport Stream (Broadcast)
  • Still widely used
    • ATSC/DVB/ISDB => TV everywhere
    • HLS (though switching to CMAF)
    • Broadcast industry

Transport Streams

  • 188 byte packets / Streaming format
  • Multiplex of "Streams" identify by PID
    • Elementary Streams : Audio/Video/Data…
    • Information (Section) : Mapping, EPG, events, …
  • A timing and buffering model : T-STD
    • Elementary Streams contain timing info
    • Program contains clock info
    • ⚠️ Timing model == buffering model

MPEG-TS "challenges"

  • Streaming format ⚠️
    • Seeking tricky, except with helpers (Bluray, AVCHD)
  • Buffering model == timing model
    • Lots of implementations get this more or less wrong
    • Some are completely off
    • `mpegtsmux` slightly off

MPEG-TS In GStreamer

  • libgstmpegts
    • Helper library for mpegts elements and applications
    • Parsing/Creating Sections and Descriptors
    • Get Sections on the bus
    • Create Section to provide to muxer

MPEG-TS in GStreamer

  • mpegtsdemux plugin
    • mpegtsparse
      • Extract individual programs
      • timestamp input based on PCR
    • tsdemux
      • Extract elementary streams
      • + seeking
  • mpegtsmux plugin
    • Multiplex elementary streams

New features (Since 2021)

  • JPEG-XS / H.266 / ST-302M
  • More Metadata support (KLV, ID3, …)
  • ST-2038 ANC support
  • Custom mapping: VP9 / AV1

New features (Since 2021)

  • tsdemux
    • Property gboolean skew-corrections
  • mpegtsmux
    • lots of fine-tuning control of output
    • Better handling of sparse streams
  • mpegtslivesrc NEW
    • Rust plugin
    • Generate a clock from PCR
    • Use with skew-corrections

Current challenges

  • mpegtsmux
    • Be more compliant in terms of buffering
  • mpegtsdemux
    • Timing handling not reliable
  • The real pain point
    • A lot of streams/files created with (very) broken muxers
    • Code tried to handle all situations
    • In the end doesn't handle compliant streams reliably

Future plan

  • New rust-based MPEG-TS demuxer
  • gst-agnostic crate
    • section/descriptor/packet parsing
    • per-PID handling
    • higher-level struct per use-case
    • demuxer, splitter, parser, analyzer
    • CLI tools for analysis/debug/testing/CI
  • Goal: Make broadcast support 24x7 reliable
    • best-effort for non-compliant streams