Crate dash_mpd

Source
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§

  • Support for downloading content from DASH MPD media streams.
  • Support for the SCTE-35 standard for insertion of alternate content

Structs§

  • Specifies the accessibility scheme used by the media content.
  • Contains a set of Representations.
  • Identifies the asset to which a given Period belongs.
  • Specifies information concerning the audio channel (e.g. stereo, multichannel).
  • A URI string that specifies one or more common locations for Segments and other resources.
  • Information on the bitstream switching capabilities for Representations.
  • A Common Encryption “Protection System Specific Header” box. Content is typically base64 encoded.
  • Describes a media content component.
  • Contains information on DRM (rights management / encryption) mechanisms used in the stream.
  • Copyright information concerning the media stream.
  • A mechanism allowing the server to send additional information to the DASH client which is synchronized with the media stream.
  • Period of time for which either failover content or no content/segments exist for the parent Representation.
  • Failover Content Segment (FCS).
  • Specifies frame-packing arrangement information of the video media component type.
  • “Inband” events are materialized by the presence of DASHEventMessageBoxes (emsg) in the media segments.
  • The first media segment in a sequence of Segments.
  • Provides a textual description of the content, which can be used by the client to allow selection of the desired media stream.
  • Licence acquisition URL for content using Microsoft PlayReady DRM.
  • A URI string to which a new request for an updated manifest should be made.
  • The root node of a parsed DASH MPD manifest.
  • Initialization data that is specific to the Microsoft PlayReady DRM.
  • The Patch mechanism allows the DASH client to retrieve a set of instructions for replacing certain parts of the MPD manifest with updated information.
  • 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).
  • A Preselection is a personalization option to produce a “complete audio experience”.
  • Specifies wall‐clock times at which media fragments were produced.
  • Metainformation concerning the media stream (title, language, etc.)
  • Specifies that content is suitable for presentation to audiences for which that rating is known to be appropriate, or for unrestricted audiences.
  • A Representation describes a version of the content, using a specific encoding and bitrate.
  • The Role specifies the purpose of this media stream (caption, subtitle, main content, etc.).
  • Describes a sequence of contiguous Segments with identical duration.
  • Scope of a namespace.
  • DASH specification MPEG extension (SCTE 214) program identification type.
  • Specifies some common information concerning media segments.
  • Contains a sequence of SegmentURL elements.
  • Allows template-based SegmentURL construction. Specifies various substitution rules using dynamic values such as $Time$ and $Number$ that map to a sequence of Segments.
  • Contains a sequence of S elements, each of which describes a sequence of contiguous segments of identical duration.
  • The URL of a media segment.
  • The original source of the media stream.
  • A SubRepresentation contains information that only applies to one media stream in a Representation.
  • Subsets provide a mechanism to restrict the combination of active Adaptation Sets.
  • Information used to allow Adaptation Set Switching (for instance, allowing the player to switch between camera angles).
  • The title of the media stream.
  • Used to synchronize the clocks of the DASH client and server, to allow low-latency streaming.

Enums§

Functions§

Type Aliases§