timed-metadata
Convert DPI / timed-metadata signalling between SCTE-35, HLS
EXT-X-DATERANGE and DASH emsg losslessly. no_std + alloc,
independently versioned.
Built on scte35-splice, isobmff, broadcast-hls, broadcast-common and
broadcast-core; used by caption-convert, transmux, hls-runtime and
multimux. The crate-root guide has the
quickstart, the How do I... task index, the module map, feature flags and
spec citations.
[]
= "0.13"
What it does / what it does not
Ad-insertion and segmentation signalling travels in three formats across an OTT
chain: SCTE-35 splice_info_section in MPEG-2 TS, #EXT-X-DATERANGE in an HLS
playlist, and an inband emsg box in MP4/CMAF. This crate translates between them.
The original splice_info_section bytes travel verbatim (DATERANGE SCTE35-* hex,
emsg message_data), so nothing is re-encoded or interpreted away. A stateful
Timeline session adds a wall-clock anchor and 33-bit PTS wrap-unrolling.
It does not parse SCTE-35 itself (that is scte35-splice), does not parse or
write full HLS playlists (broadcast-hls) or full MP4 files, and does not make
ad decisions. It does not convert captions: caption-convert owns the
CEA-608/708 and Teletext cue extractors and the WebVTT/SRT writers, over
dvb-vbi's page decode.
Standards supported
| Standard | Edition | Scope | Status | Notes |
|---|---|---|---|---|
| ANSI/SCTE 35 | 2023r1 (via scte35-splice) |
splice_info_section carried verbatim and parsed for id/time/duration |
Full | |
| IETF RFC 8216 / draft-pantos-hls-rfc8216bis | draft -22 (1 May 2026, private/specs-verified/ietf/specs/ietf_draft_pantos_hls_rfc8216bis.txt) |
§4.4.5.1 EXT-X-DATERANGE attributes incl. SCTE35-CMD/OUT/IN |
Partial | SCTE-35 to DATERANGE and DATERANGE tag-line parse/render; no DATERANGE to SCTE-35 event conversion. |
| ANSI/SCTE 214-1 | 2024, private/specs-verified/scte/dash/scte-214-1-2024.md |
§7.7.1 inband events, §7.7.3 SCTE 35 inband emsg |
Full for the binary scheme | The 214-3 2015 transcription only held the scheme identity; the rules moved into 214-1 2024. MPD EventStream (§7.7.2.1) is not implemented. |
ISO/IEC 23009-1 (via isobmff) |
unverified | §5.10.3.3 Event Message Box, v0 <-> v1 re-timing | Full | emsg_to_v0 / emsg_to_v1 |
Conversion matrix
| From \ To | HLS EXT-X-DATERANGE |
DASH emsg |
SCTE-35 bytes |
|---|---|---|---|
SCTE-35 splice_info_section |
Timeline::to_daterange / convert::scte35_to_daterange |
Timeline::to_emsg / convert::scte35_to_emsg |
identity |
DASH emsg (SCTE-35 scheme) |
not provided | emsg_to_v0 / emsg_to_v1 (re-time) |
convert::emsg_to_scte35 |
HLS EXT-X-DATERANGE |
tag-line DateRange::parse_tag_line / to_tag_line |
not provided | raw bytes available on the parsed DateRange; no typed conversion |
Feature flags
| Feature | Default | Description |
|---|---|---|
std |
on | Enable std in all dependencies. Without it: no_std + alloc, all conversions still available. |
serde |
off | Serialize/Deserialize on public types where supported. |
serde is opt-in and off by default; enable it explicitly:
= { = "0.13", = ["serde"] }
Quick start
use Timescale;
use PresentationTime;
use ;
use ;
// A real Unified Streaming splice_info_section (splice id 2002, 24 s break).
let hex = "FC302100000000000000FFF01005000007D27FEF7F7E0020F580C0000000000088B9661D";
let raw: =
.step_by
.map
.collect;
// Wall-clock anchor: PTS 0 == 2024-01-15T12:00:00 UTC.
let anchor = TimeAnchor ;
let mut timeline = new;
let event = timeline.push_scte35.unwrap;
// Edge 1: SCTE-35 -> HLS EXT-X-DATERANGE.
let line = timeline.to_daterange.unwrap.to_tag_line.unwrap;
assert!;
assert!;
// Edge 2: SCTE-35 -> DASH emsg, and Edge 3: back to the verbatim section.
let cfg = new;
let emsg = timeline.to_emsg.unwrap;
assert_eq!;
What is implemented
convert: pure functionsscte35_to_daterange,scte35_to_emsg,emsg_to_scte35,scte35_event_duration,emsg_to_v0,emsg_to_v1;EmsgConfig,SegmentTiming. SCTE 35emsgemission is version 1 and an unknown duration isNone/0xFFFFFFFF(214-1 2024 §7.7.1, §7.7.3).Timeline/TimeAnchor: stateful session, PTS to UTC mapping, 33-bit PTS wrap-unroll viabroadcast_common::clock33; RFC 3339 output throughjiff(out-of-range instants clamp rather than print odd years).DateRange: frombroadcast-hls, the workspace's one typedEXT-X-DATERANGEmodel (checked rendering:to_tag_linereturnsResult, and anID/CLASScontaining", CR or LF, or a NaN / negative duration, is rejected). This crate only decides which attributes a SCTE-35 event puts on it.TimedEvent: neutral event (EventKind, id, media time and duration, source payload).PtsUnroller: the 33-bit PTS wrap-unrollTimelineuses, exported so a caption extractor incaption-convertunrolls on the same timeline.
Design notes
- Lossless carriage: SCTE-35 bytes are never re-encoded.
Erroris#[non_exhaustive]; the crate is#![forbid(unsafe_code)]andno_std+allocwithoutstd.- Hostile-input hardening: checked time arithmetic, a
clock33tripwire test.
Related crates
Depends on broadcast-common, broadcast-core, broadcast-hls, isobmff and scte35-splice. Used
by caption-convert, transmux, hls-runtime, media-plane, multimux,
media-doctor and compliance-probe.
MSRV and licence
Rust 1.95.0. MIT OR Apache-2.0.