Expand description
A Rust library for parsing, serializing and downloading media content from a DASH MPD manifest, as used for on-demand replay of TV content and video streaming services. Allows both parsing of a DASH manifest (XML format) to Rust structs (deserialization) and programmatic generation of an MPD manifest (serialization). The library also allows you to download media content from a streaming server. DASH (dynamic adaptive streaming over HTTP), also called MPEG-DASH, is a technology used for media streaming over the web, commonly used for video on demand (VOD) services. The Media Presentation Description (MPD) is a description of the resources (manifest or “playlist”) forming a streaming service, that a DASH client uses to determine which assets to request in order to perform adaptive streaming of the content. DASH MPD manifests can be used both with content encoded as MPEG and as WebM.
This library provides a serde-based parser (deserializer) and serializer for the DASH MPD format, as formally defined in ISO/IEC standard 23009-1:2022. This version of the standard is available for free online. XML schema files are available for no cost from ISO. When MPD files in practical use diverge from the formal standard, this library prefers to interoperate with existing practice.
The library does not yet provide full coverage of the fifth edition of the specification. All elements and attributes in common use are supported, however.
The library also provides experimental support for downloading content (audio or video)
described by an MPD manifest. This involves selecting the alternative with the most appropriate
encoding (in terms of bitrate, codec, etc.), fetching segments of the content using HTTP or
HTTPS requests (this functionality depends on the reqwest
crate) and muxing audio and video
segments together (using ffmpeg via the ac_ffmpeg
crate).
§DASH features supported
- VOD (static) stream manifests
- Multi-period content
- XLink elements (only with actuate=onLoad semantics, resolve-to-zero supported)
- All forms of segment index info: SegmentBase@indexRange, SegmentTimeline, SegmentTemplate@duration, SegmentTemplate@index, SegmentList
- Media containers of types supported by mkvmerge, ffmpeg, VLC and MP4Box (this includes Matroska, ISO-BMFF / CMAF / MP4, WebM, MPEG-2 TS)
- Subtitles: preliminary support for WebVTT and TTML streams
§Limitations / unsupported features
- Dynamic MPD manifests, that are used for live streaming/OTT TV
- XLink with actuate=onRequest semantics
- Application of MPD patches
Modules§
- fetch
- Support for downloading content from DASH MPD media streams.
- scte35
- Support for the SCTE-35 standard for insertion of alternate content
- sidx
Structs§
- Accessibility
- Specifies the accessibility scheme used by the media content.
- Adaptation
Set - Contains a set of Representations.
- Asset
Identifier - Identifies the asset to which a given Period belongs.
- Audio
Channel Configuration - Specifies information concerning the audio channel (e.g. stereo, multichannel).
- BaseURL
- A URI string that specifies one or more common locations for Segments and other resources.
- Bitstream
Switching - Information on the bitstream switching capabilities for Representations.
- Cenc
Pssh - A Common Encryption “Protection System Specific Header” box. Content is typically base64 encoded.
- Content
Component - Describes a media content component.
- Content
Protection - Contains information on DRM (rights management / encryption) mechanisms used in the stream.
- Copyright
- Copyright information concerning the media stream.
- Essential
Property - Event
- A mechanism allowing the server to send additional information to the DASH client which is synchronized with the media stream.
- Event
Stream - Failover
Content - Period of time for which either failover content or no content/segments exist for the
parent
Representation
. - Fcs
- Failover Content Segment (FCS).
- Frame
Packing - Specifies frame-packing arrangement information of the video media component type.
- Inband
Event Stream - “Inband” events are materialized by the presence of DASHEventMessageBoxes (emsg) in the media segments.
- Initialization
- The first media segment in a sequence of Segments.
- Label
- Provides a textual description of the content, which can be used by the client to allow selection of the desired media stream.
- Language
- Latency
- Laurl
- Licence acquisition URL for content using Microsoft PlayReady DRM.
- Leap
Second Information - Location
- A URI string to which a new request for an updated manifest should be made.
- MPD
- The root node of a parsed DASH MPD manifest.
- Metrics
- MsprIV
Size - Mspr
IsEncrypted - MsprKid
- MsprPro
- Initialization data that is specific to the Microsoft PlayReady DRM.
- Output
Protection - Patch
Location - The Patch mechanism allows the DASH client to retrieve a set of instructions for replacing certain parts of the MPD manifest with updated information.
- Period
- Describes a chunk of the content with a start time and a duration. Content can be split up into multiple periods (such as chapters, advertising segments).
- Playback
Rate - Preselection
- A Preselection is a personalization option to produce a “complete audio experience”.
- Producer
Reference Time - Specifies wall‐clock times at which media fragments were produced.
- Program
Information - Metainformation concerning the media stream (title, language, etc.)
- Range
- Rating
- Specifies that content is suitable for presentation to audiences for which that rating is known to be appropriate, or for unrestricted audiences.
- Reporting
- Representation
- A Representation describes a version of the content, using a specific encoding and bitrate.
- Representation
Index - Resync
- Role
- The Role specifies the purpose of this media stream (caption, subtitle, main content, etc.).
- S
- Describes a sequence of contiguous Segments with identical duration.
- Scope
- Scope of a namespace.
- Scte214
Content Identifier - DASH specification MPEG extension (SCTE 214) program identification type.
- Segment
Base - Specifies some common information concerning media segments.
- Segment
List - Contains a sequence of SegmentURL elements.
- Segment
Template - Allows template-based
SegmentURL
construction. Specifies various substitution rules using dynamic values such as$Time$
and$Number$
that map to a sequence of Segments. - Segment
Timeline - Contains a sequence of
S
elements, each of which describes a sequence of contiguous segments of identical duration. - SegmentURL
- The URL of a media segment.
- Selection
- Selection
Info - Service
Description - Source
- The original source of the media stream.
- SubRepresentation
- A SubRepresentation contains information that only applies to one media stream in a Representation.
- Subset
- Subsets provide a mechanism to restrict the combination of active Adaptation Sets.
- Supplemental
Property - Switching
- Information used to allow Adaptation Set Switching (for instance, allowing the player to switch between camera angles).
- Title
- The title of the media stream.
- UTCTiming
- Used to synchronize the clocks of the DASH client and server, to allow low-latency streaming.
- Viewpoint
Enums§
Functions§
- check_
conformity - Returns a list of DASH conformity errors in the DASH manifest mpd.
- is_
audio_ adaptation - Returns
true
if this AdaptationSet contains audio content. - is_
subtitle_ adaptation - Returns
true
if this AdaptationSet contains subtitle content. - is_
video_ adaptation - Returns
true
if this AdaptationSet contains video content. - parse
- Parse an MPD manifest, provided as an XML string, returning an
MPD
node. - subtitle_
type
Type Aliases§
- XsDatetime
- Type representing an xs:dateTime, as per https://www.w3.org/TR/xmlschema-2/#dateTime