Skip to content

Add MMT/TLV extractor for ISDB-S3 4K/8K broadcast streams#3332

Open
osscv wants to merge 2 commits into
androidx:mainfrom
osscv:MMT/TLV
Open

Add MMT/TLV extractor for ISDB-S3 4K/8K broadcast streams#3332
osscv wants to merge 2 commits into
androidx:mainfrom
osscv:MMT/TLV

Conversation

@osscv

@osscv osscv commented Jul 13, 2026

Copy link
Copy Markdown

Summary

Adds a new androidx.media3.extractor.mmt package that demultiplexes MMT
(MPEG Media Transport) carried over TLV (Type-Length-Value) packets — the
transport stack used by ISDB-S3 4K/8K broadcasting (e.g. NHK BS4K/BS8K).

The transport is parsed end to end:

  • TlvExtractor — sniffs and parses the TLV layer (IPv4 / IPv6 /
    header-compressed IP / signalling / null packets) and unwraps IP + UDP.
  • MmtpReader — parses MMTP packet headers and reassembles MPU/MFU
    fragments (fragmentation-indicator + aggregation) into access units.
  • MmtSignalingParser — parses the PA message / MMT Package Table (MPT)
    to map each packet_id to an asset type.

HEVC and AVC assets are output by reusing the existing H265Reader /
H264Reader elementary-stream readers. The format is wired into
DefaultExtractorsFactory, FileTypes.MMT_TLV, MimeTypes.VIDEO_MMT_TLV
and .mmt/.mmts/.tlv extension detection, so the extractor is selected
by both content sniffing and MIME/extension.

Parsing was validated against live NHK BS4K/BS8K captures, which are
delivered almost entirely as header-compressed IP and set the PA message's
number_of_tables to 0 with the tables inlined — the MPT parser walks the
concatenated tables to handle this.

Unit tests cover TLV sniffing, MPT asset discovery, and the end-to-end
compressed-IP → MMTP → MPT → track-creation pipeline.

osscv added 2 commits July 13, 2026 08:41
Adds support to Media3 for demultiplexing MMT (MPEG Media Transport)
carried over TLV (Type-Length-Value) packets, the transport stack used
by ISDB-S3 4K/8K broadcasting (e.g. NHK BS4K/BS8K).

New `androidx.media3.extractor.mmt` package:

* TlvExtractor: sniffs and parses the TLV layer (IPv4 / IPv6 /
  header-compressed IP / signalling / null packets), unwraps IP + UDP
  and forwards MMTP packets.
* MmtpReader: parses MMTP packet headers, routes signalling to the
  package-table parser, and reassembles MPU/MFU fragments (with
  fragmentation-indicator and aggregation handling) into access units.
* MmtSignalingParser: parses the PA message / MMT Package Table (MPT) to
  map each packet_id to an asset type.
* HEVC and AVC assets are output as samples by reusing the existing
  H265Reader / H264Reader elementary-stream readers.

Wires the format into DefaultExtractorsFactory, FileTypes.MMT_TLV,
MimeTypes.VIDEO_MMT_TLV, and .mmt/.mmts/.tlv extension detection, so the
extractor is selected both by content sniffing and by MIME/extension.

Adds unit tests for TLV sniffing and MPT asset discovery.

Broadcast-specific extras are marked with TODOs and not yet implemented:
accurate per-sample timing (MPU metadata moof/trun + MPU_timestamp
descriptor), MH-AAC / MPEG-H 3D audio, ARIB subtitles, full
header-compression context handling, and non-"same-flow" asset
locations.
Analysis of live NHK BS4K/BS8K MMT/TLV captures showed the PA message
sets number_of_tables=0 and inlines the tables directly, so the previous
ISO-strict, index-driven parser discovered zero assets and produced no
tracks.

MmtSignalingParser.parsePaMessage now skips the (possibly empty) table
index and walks the concatenated tables by their own
{table_id, version, length} headers, which handles both the indexed and
the inlined layouts. Each table's length is used to advance, with a
zero-length guard.

Confirmed asset maps from the captures:
* BS8K: hev1 video, mp4a (MPEG-4 AAC) audio, 2x stpp (TTML) subtitles.
* BS4K: hev1 video, 2x mp4a audio, stpp subtitles, several aapp data
  (application) assets.

Both streams are transported almost entirely as header-compressed IP
(TLV type 0x03, context types 0x60/0x61), validating that path.

Adds an end-to-end TlvExtractor test that drives a header-compressed IP
packet carrying an MMTP signaling packet / MPT and asserts a video track
is created, plus updates the signaling parser test to use the real
inlined-table framing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants