-
Serialization: The order of elements in the Rust structures used for serialization and deserialization of an MPD now follows that of the XML schema for DASH. This means that serialized XML manifests should now be compliant with the specification (assuming that you specify values for any mandatory elements). It is not expected that this will produce any changes for software that consumes DASH manifests; few consumers seem to care about the order of elements. We are currently following the XSD for the 5th version of the DASH specification, available at https://github.com/MPEGGroup/DASHSchema/blob/5th-Ed-AMD1/DASH-MPD.xsd.
We are make a beta release due to the breaking changes in this release. Testing is very welcome; please report any validation bugs you may encounter.
-
MPD.ProgramInformation
andMPD.ServiceDescription
are now represented as a Vec, rather than as an Option type. -
SegmentBase.Initialization
is now represented as a Vec, rather than an Option type. -
RepresentationIndex
elements are all renamed torepresentation_index
. -
Period
elements now contain optionalSegmentBase
andSegmentList
elements (rarely used in practice). -
AdaptationSet
elements now contain a vector ofFramePacking
elements. -
Event
elements now contain an optionalSelectionInfo
element. -
EventStream
elements now contain amessageData
attribute, as per the specification. -
BaseURL
elements now contain an optional attributetimeShiftBufferDepth
. -
Representation
andSubRepresentation
elements contain optionalOutputProtection
elements. -
Resync
attributesdImax
anddImin
are of type f64 instead of u64. An additional attributemarker
has been added. -
All
schemeIdUri
attributes on DASH elements are now required, rather than optional, as per the XSD specification. -
ProducerReferenceTime.UTCTiming
is an Option rather than a Vec.
- Serialization: add support for the XML namespace prefix that is traditionally used for the
Microsoft PlayReady scheme (
mspr:
). Patch from @bwjun-tving.
-
Downloading: support for the use of sidx index information for manifests that use SegmentBase@indexRange addressing. Use of this download mode, which is enabled by default for ISOBMFF/MP4 content, is controlled by a new method
use_index_range
on DashDownloader.If set to true (the default value), downloads of media whose manifest uses SegmentBase@indexRange addressing will retrieve the index information (currently only sidx information used in ISOBMFF/MP4 containers; Cue information for WebM containers is currently not supported) with a byte range request, then retrieve and concatenate the different bytes ranges indicated in the index. This avoids downloading the content identified by the BaseURL as a very large chunk, which can fill up RAM and is banned by certain content servers.
If set to false (which corresponds to the default download mode prior to this version of the library), the BaseURL content will be downloaded as a single large chunk. This may be more robust on certain content streams that have been encoded in a manner which is not suitable for byte range retrieval.
-
Downloading: fix duplicated merge of BaseURLS for video segments. Patch from @jonasgrosch.
-
Downloading: add the ability to download from file:// URLs. This requires the MPD manifest to specify an absolute BaseURL element at the MPD, Period or Representation level, or to use absolute URLS for all media segments.
-
Downloading: add support for the ffmpeg “concat demuxer” as a concatenation helper for multiperiod manifests, as an alternative to the existing ffmpeg “concat filter” support. To use this concatenation helper, all Periods must use the same encoding (same codecs, same time base, etc.), though they may be wrapped in different container formats. This concatenation helper is very fast because it copies the media streams, rather than reencoding them.
In a typical use case of a multi-period DASH manifest with DAI (where Periods containing advertising have been intermixed with Periods of content), where it is possible to drop the advertising segments (using
minimum_period_duration()
or using an XSLT filter on Period elements), the content segments are likely to all use the same codecs and encoding parameters, so this concat helper should work well.Use it with
--concat-preference mp4:ffmpegdemuxer
for example. -
Downloading: fix an additional possible off-by-one error in calculating the segment count for
$Time$
-based manifests (useround()
instead ofceil()
). -
Downloading: log additional diagnostics information when the verbosity level is greater than 0 or 1 for external commands run for muxing, concatenating, subtitle extraction/merging, and decrypting. The logged information includes the full commandline.
-
Added some random robustness checks for parsing functions, using the proptest crate.
-
Fixed: the concatenation of multiperiod manifests using the ffmpeg concat filter was erroneously adding an empty audio track when none of the input Periods contained audio.
-
Downloading: improvements to the handling of subtitles: we make additional efforts to extract STPP subtitles from a sequence of fMP4 segments, as a
.ttml
file. ffmpeg does not currently seem to be able to extract this in the more commonly supported SRT format. When saving to a Matroska container (.mkv
or.webm
output files), we attempt to embed subtitle tracks with mkvmerge instead of with MP4Box (which fails). -
Downloading: fix off-by-one bug in the calculation of the number of media fragments to download when using SegmentTemplate addressing with
$Number$
. The initialiation segment was being counted towards the number of segments, but should not be. Bug reported by @vidasi.
-
Serialization to XML: fix the ordering of elements in
MPD
andPeriod
elements to match those of the DASH specification. Most parsers and consumers of DASH manifests will not be affected by this change, but we have updated the y component in our x.y.z semantic versioning nonetheless. -
Parsing xs_duration: truncate nanoseconds to 9 rather than 8 digits of precision. Bug noted by @sbuzzard.
-
Downloading: when the audio and video tracks are unsynchronized due to a difference in their startTime attribute, we attempt to fix this desynchronization during muxing. This is a rare problem in the wild and has not been heavily tested. The fix is currently only implemented when using ffmpeg as a muxer application (uses the
-itsoffset
commandline option).
-
Progress reporters will be called (and the progress bar updated) more frequently, and more reliably when segment sizes are small and network speeds are high (suggestion from @filiptibell).
-
Update protobuf-src which was causing builds to fail, and move to current versions of crates in the axum ecosystem used for tests.
-
Period
elements can contain aPreselection
element (from @sbuzzard).
- The
scte214:supplementalProfiles
andsupplementalCodecs
attributes can live at the level of anAdaptationSet
element, in addition toRepresentation
element (from @sbuzzard).
-
Downloading: fix a bug in concatenation for multiperiod manifests that occurs when one of the Periods does not contain any audio.
-
Downloading: add support for concatenating streams in multi-period manifests using mkvmerge, as an alternative to the existing support for concatenation using ffmpeg. The preference ordering for concatenation helpers is specified by method
with_concat_helper
onDashDownloader
. Concatenation using mkvmerge works at least with MP4 and with Matroska (.mkv) containers. It tends to be much faster than using ffmpeg but also less robust (less tolerant of the variety of media encoding specificities found in the wild). You can specify multiple concatenation helpers, in which case they will be called sequentially until one of them returns a success code. -
Downloading: accomodate manifests which say a Representation has
mimeType="video/mp4"
andcodecs="mp4a"
. These are now detected as audio streams rather than as video streams. -
Allow the user to specify a preference for streams based on the value of the
Role
element in anAdaptationSet
. Streaming services sometimes publish various additional streams marked with roles such asalternate
orsupplementary
ordescription
, in addition to the main stream which is generalled labelled with a role ofmain
. The user can specify a preference order for these role annotations, which is applied after the language preference and before the width/height/quality preference. -
Add scte214 attributes
@supplementalProfiles
and@supplementalCodecs
toRepresentation
nodes (from @sbuzzard).
-
Downloading: new method
minimum_period_duration()
onDashDownloader
. Periods whose duration is less than this value will not be downloaded. -
Downloading: fix a bug in the concatenation of multiperiod manifests. When per-Period files contained both audio and video content, the content was being included twice in the concatenated file. Add an integration test for concatenation using ffmpeg.
-
AssetIdentifier
andSupplementalProperty
elements may containScte214ContentIdentifier
elements, as per the SCTE 214-1 specification (from @sbuzzard).
-
Fix bug in filename handling when using the ffmpeg concatenation filter. Filenames were not properly escaped when passed as arguments to the
filter_complex
commandline argument. -
Add support for subtitles that use SegmentBase addressing.
-
Subtitles in STPP format (a data stream in MP4 fragments) are now converted to TTML format. The XML data stream is extracted using ffmpeg. If the conversion is successful it will be saved to a file with the same name as the output file, but with a
.ttml
extension.
- Network requests for media fragments that fail are retried a certain number of times. The number
of retries for each fragment request can be set using the
fragment_retry_count
method onDashDownloader
(default is 10). Network errors that are identified as being transient (for example, network timeouts) do not count towards this retry count. Network requests were previously retried only if they were identified as transient, but anecdotally it seems that the internet and CDN servers are not set up in a way that allows transient errors reliably to be distinguished from non-transient errors. Non-transient retries still count towards themax_error_count
, whose default value is increased to 30.
-
New error types
NetworkTimeout
andNetworkConnect
inDashMpdError
. These error types would previously have been reported as theNetwork
error type. This is an API incompatible change. -
Error messages include additional contextual information (they are formatted using
Debug
instead ofDisplay
). For example, a network connection error caused by a TLS configuration error will include information on the underlying issue. -
The
ContentProtection.clearkey:Laurl
element, containing information on the license acquisition URL, is superseded by theContentProtection.dashif:laurl
element. We parse the former to an field (re)namedclearkey_laurl
and the latter to the fieldlaurl
inContentProtection
elements. Some manifests in the wild use both of these names, and we can't parse both into a Vec due to a parser limitation when using aliases. This is an API incompatible change. Reported by @pando-emil. -
The
trust-dns
build feature has been renamed tohickory-dns
following the same rename in the reqwest crate, which was triggered by the change in name of the Hickory DNS resolver. The old name is still supported, but is deprecated.
-
Type of
S.@t
andS.@d
attributes changed fromOption<i64>
toOption<u64>
, to conform to the DASH specification. This is an API-breaking change which requires a semver bump. -
Add support for
MPD.ContentProtection
elements, as per the fifth edition of the DASH specification (ISO/IEC 23009-1:2021). -
Add support for
Period.Subset
elements. -
Add support for a
FailoverContent
element in aSegmentTemplate
element. The XSD included in the DASH specification only includes aFailoverContent
element on theSegmentBase
element, but also includes it on aSegmentTemplate
element in one of the examples. Even if examples are not normative, we choose to be tolerant in parsing. -
Add support for
@n
and@k
attributes onSegmentTimeline.S
elements. -
Downloading: fix the support for specifying referer using the
with_referer
method onDashDownloader
(bug reported by @yoyo890121).
-
The tokio crate is now an optional feature, only needed when the
fetch
feature is enabled. This oversight was pointed out by @pando-fredrik. -
Add
SegmentTimeline
element toSegmentList
elements (from @erik-moqvist). -
Add definition for
BitstreamSwitching
elements toSegmentTemplate
andSegmentList
nodes. -
Fix type of
@bitstreamSwitching
attribute onSegmentTemplate
elements (xs:string rather than xs:bool as for all other uses of the@bitstreamSwitching
attribute). -
Fix type of
@audioSamplingRate
attributes on various elements (xs:string rather than u64). -
Downloading: add support for specifying the Referer HTTP header explicitly, through the
with_referer
method onDashDownloader
. It was previously possible to specify the Referer by adding it to the default headers in the user-provided reqwestClient
. However, we were not able to distinguish whether this had been specified by the caller or not, so were not able to add a relevant Referer header only in the absence of a user-provided Referer. Referer headers are included in all HTTP requests, for the MPD manifest, for audio and video segments, and for subtitle content. -
Downloading: default to enabling cookie support in the reqwest Client used for network requests. Cookies set while retrieving the MPD manifest will be included in requests for media segments. (In practice, media servers rarely check cookies, as doing so is expensive on a CDN infrastructure.)
-
Downloading: fix handling of XLinked elements when remote XML fragment contains multiple elements.
-
Fix the serialization of various attributes that are declared as being of type
xsd:double
in the DASH XML Schema definition. These are represented as Rust f64 values, but need to be serialized slightly differently (in particular for values +INF, -INF, NaN that were previously serialized incorrectly). Bug reported by @ypo (#49). -
Add some missing ContentProtection uids and rename ChinaDRM as WisePlay (they share the same system ID, and WisePlay seems to be more prevalent than ChinaDRM).
-
Downloading: fix the handling of XLinked elements. The Shaka heliocentrism test case now works correctly.
-
Downloading: Widevine and PlayReady initialization data will now be decoded and pretty printed, alongside their Base64 representation (uses the new
pssh-box
crate). -
Downloading: fix concatenation for multiperiod manifests in situations where one period has audio and another has no audio track.
-
The library uses the
tracing
crate for all logging purposes, and will no longer print anything to stdout or stderr. Users should use atracing_subscriber
functionality to obtain logging information. -
Downloading: Fix bug in the handling of toplevel
Period.SegmentTemplate
elements (rarely present in the wild, but allowed by the DASH specification). -
Regexps used for parsing are statically allocated to avoid ongoing memory allocation overheads.
-
Downloading: When deciding whether video files can be concatenated using the ffmpeg concat muxer, we allow for missing sar metainformation (not always present in MP4 containers in the wild).
-
Downloading: include the query component of the MPD URL in requests for media segments, to support the token-based authentication used by some streaming services. If the manifest URL is
https://example.com/manifest.mpd?token=foo
, requests to segments will look like/segment/42.m4v?token=foo
, unless the manifest includes an explicit query component in the segment URLs. -
Muxing to a WebM container using the VLC external muxer should be fixed.
-
Downloading: Display current download bandwidth in the progress bar, if it is activated.
-
Parsing: the path to the unparsable element is now shown, which greatly facilitates debugging! Uses the
serde_path_to_error
crate. The output is something like"Period[0].EventStream[0].Event[0].Signal[0].Binary.$value[0]: invalid digit found in string"
-
Parsing: when the
warn_ignored_elements
build feature is enabled, a warning will be issued when an XML element present in the manifest is not deserialized into a Rust struct. The default behaviour is to ignore elements for which we have not defined serde deserialization instructions. This feature is implemented with theserde_ignored
crate. -
Parsing: we no longer attempt to decode SCTE-35 Cue messages as Base64. Their format is more complicated than Base64 and attempting to decode them naively can generate spurious parse errors.
-
Downloading: fix the calculation of audio segments to be downloaded for a live stream for which
force_duration
has been specified.
-
Add possibility to use Shaka packager application for decryption of media with Content Protection, as an alternative to mp4decrypt. The shaka-packager application is able to handle more media formats (e.g. WebM/Matroska containers) and is better maintained than mp4decrypt. See method
with_decryptor_preference
onDashDownloader
. -
New method
allow_live_streams
on DashDownloader that makes it possible to attempt to download from a live (dynamic) manifest. Downloading from a genuinely live stream won't work well, because we don't implement the clock-related throttling needed to only download media segments when they become available. However, some media sources publish “pseudo-live” streams where all media segments are in fact available (they don't update the manifest once the live is complete), which we will be able to download. You might also have some success in combination with thesleep_between_requests
method. -
New method
force_duration(secs)
onDashDownloader
to specify the number of seconds to capture from the media stream, overriding the duration specified in the DASH manifest. This is mostly useful for live streams, whose duration is often not specified. It can also be used to capture only the first part of certain normal (static/on-demand) media streams, though this functionality is not currently fully implemented for all segment description types. -
Fix the selection of the desired Representation (according to the user's quality/resolution preferences) for DASH manifests that include multiple AdaptationSets. This is the case on some manifests that offer media streams using different codecs. We were previously only examining Representation elements in the first AdaptationSet present in the manifest.
-
Reduce memory usage when downloading media segments by using the reqwest crate's chunk API, instead of reading all content using the
bytes()
method. This is important for DASH manifests that use indexRange addressing, which we don't download using byte range requests as a normal DASH client would do, but rather download using a single network request.
-
Add
@pdDelta
attribute onSegmentTemplate
andSegmentBase
elements. -
Add preliminary support for applying rewrite rules to the MPD manifest before downloading media segments. Rewrite rules are expressed as XSLT stylesheets that are applied to the manifest using the
xsltproc
commandline tool (which supports XSLT v1.0). This allows complex rewrite rules to be expressed using a standard (if a little finicky) stylesheet language. See thewith_xslt_stylesheet()
method onDashDownloader
.This functionality and API are experimental, and may evolve to use a different XSLT processor, such as Saxon-HE (https://github.com/Saxonica/Saxon-HE/) which has support for XSLT v3.0, but is implemented in Java. Alternatively, a more general filtering functionality based on WASM bytecode might be implemented to allow the implementation of rewrite rules in a range of languages that can compile to WebAssembly.
-
DASH conformity checks are now optional, controlled by a call to
conformity_checks()
onDashDownloader
(default is to run conformity checks). Conformity checks will print a warning to stderr instead of causing a download to fail (a surprising number of manifests, including some generated by the most widely used commercial streaming software, include non-conformities such as incorrect values of @maxWidth / @maxHeight or inserted advertising segments that don't respect @maxSegmentDuration). -
Downloading: change the default ordering of muxer applications when saving media to a .webm container to prefer VLC over ffmpeg. With the commandline arguments that we use, ffmpeg does not automatically reencode content to a codec that is allowed by the WebM specification, whereas VLC does do so.
-
Add preliminary support for some simple conformity checks on DASH manifests during parsing.
-
Implement
std::fmt::Display
onMPD
structs, which makes it possible to serialize them easily using.to_string()
(thanks to @Yesterday17). -
Add attribute
presentationTimeOffset
toEventStream
elements (thanks to @sbuzzard). -
Downloading: allow the user to specify the order in which muxer applications are tried, instead of using a hard-coded ordering per container type. The ordering is specified per container type ("mkv", "mp4", "avi", "ts", etc.). The user specifies an ordering such as "ffmpeg,vlc,mp4box" which means that ffmpeg is tried first, and if that fails vlc, and if that fails mp4box. The muxers currently available are ffmpeg, vlc, mkvmerge and mp4box. See function
with_muxer_preference
onDashDownloader
. -
Downloading: work around a bug in VLC, which does not correctly report failure to mux via a non-zero exit code.
-
Downloading: enable support for Bearer authentication of network requests to retrieve the manifest and the media segments. See function
with_auth_bearer
onDashDownloader
. This is the authentication method specified in RFC 6750, originally designed for OAuth 2.0, but also used in other settings such as JSON Web Token (JWT). -
Downloading: enable support for MPEG-4 Part 17 (Timed Text) subtitles (tx3g codec). They will be converted to SRT format if the MP4Box commandline application is installed.
-
Downloading: when printing the available media streams, print
Role
andLabel
information if they are specified on anAdaptationSet
element. -
Fix naming/parsing of
MPD.Location
field (thanks to @nissy34).
-
Downloading: add support for selecting the desired video stream based on its resolution. See functions
prefer_video_width
andprefer_video_height
onDashDownloader
. -
Downloading: new function
intermediate_quality
onDashDownloader
which controls the choice of media stream when multiple Adaptations are specified. This requests the download of the Adaptation with an intermediate bitrate (closest to the median value). Similar tobest_quality
andworst_quality
functions. -
Downloading: enable support for authentication of network requests to retrieve the manifest and the media segments. See function
with_authentication
onDashDownloader
. This provides support only for the “Basic” HTTP authentication scheme (RFC 7617). Bearer authentication (RFC 6750) is not currently supported. -
Downloading: improve support for selecting the output container format based on its filename extension. Selecting an output file with an
.mkv
extension will now produce an output file in Matroska container format, even in cases where the manifest only contains a video stream or only an audio stream (shortcircuiting the muxing functionality). In these cases, the stream will be copied if the output container requested is compatible with the downloaded stream format, and otherwise a new media container with the requested format will be created and the audio or video stream will be inserted (and reencoded if necessary) into the output file. This insertion and reencoding is undertaken by the same commandline applications used for muxing: ffmpeg, mkvmerge, mp4box (currently not vlc). This support is not currently implemented when building with the libav feature. -
Derive
Hash
on those structs for which it can be derived automatically.
- Support for certain nodes used with PlayReady ContentProtection:
clearkey:Laurl
,mspr:pro
,mspr:IsEncrypted
,mspr:IV_Size
,mspd:kid
.
- Downloading: improve support for multiperiod manifests. When the contents of the different periods can be joined into a single output container (because they share the same resolution, frame rate and aspect ratio), we concatenate them using ffmpeg (with reencoding in case the codecs in the various periods are different). If they cannot be joined, we save the content in output files named according to the requested output file (whose name is used for the first period). Names ressemble "output-p2.mp4" for the second period, and so on.
- Downloading: new function
concatenate_periods
onDashDownloader
to specify whether the concatenation (which is very CPU-intensive due to the reencoding) of multi-period manifests should be attempted. The default behaviour is to concatenate when the media contents allow it. - Downloading: improved support for certain addressing types on subtitles (AdaptationSet>SegmentList, Representation>SegmentList, SegmentTemplate+SegmentTimeline addressing modes).
- Significantly improved support for XLink semantics on elements (remote elements). In particular, resolve-to-zero semantics are implemented, a remote XLinked element may resolve to multiple elements (e.g. a Period with href pointing to a remote MPD fragment may resolve to three final Period elements), and a remote XLinked element may contain a remote XLinked element (the number of repeated resolutions is limited, to avoid DoS attacks).
- Change element
Accessibility
ofContentComponent
andAdaptationSet
nodes to aVec
instead of anOption
(incompatible change). - Downloading: handling of STPP subtitles distributed as fragmented MP4 segments has been improved. They will be merged with the final output container if MP4Box is installed.
- Downloading: more diagnostics information is printed concerning the selected audio/video streams, when requested verbosity is higher than 1. In particular, pssh information will be printed for streams with ContentProtection whose pssh is embedded in the initialization segments rather than in the DASH manifest.
- Downloading: function
fetch_subtitles
onDashDownloader
takes a boolean parameter, instead of unconditionally requesting retrieval of subtitle content (incompatible change).
- Downloading: new functions
fetch_audio
andfetch_video
onDashDownloader
. - Downloading: improve support for retrieving subtitles that are distributed in fragmented MP4 streams (in particular WebVTT/STPP).
- Downloading: more diagnostics information printed concerning the selected audio/video streams.
- Downloading: add support for decrypting encrypted media content, using the Bento4 mp4decrypt
commandline application. Decryption keys can be specified using the
add_decryption_key
function onDashDownloader
. The location of the mp4decrypt binary can be specified using thewith_mp4decrypt_location
function onDashDownloader
, if it is not located in the PATH.
- Change element
InbandEventStream
ofRepresentation
andAdaptationSet
nodes to aVec
instead of anOption
(incompatible change). - Fix spurious error regarding deletion of temporary file for audio/video segments when using
keep_audio
/keep_video
in conjunction withfetch_audio
/fetch_video
. - Downloading: show download bitrate for audio and video streams in verbose mode.
- Downloading: incompatible change to the
keep_audio
andkeep_video
attributes on DashDownloader, to allow the user to specify the path for the audio and video files. - Print information on the different media streams available (resolution, bitrate, codec) in a manifest when requested verbosity is non-zero.
- Update dependency quick-xml to v0.29 (thanks to @sdroege).
- Downloading: a connect error is handled as a permanent, rather than a transient, error. In particular, TLS certificate verification errors will no longer be treated as transient errors.
- Downloading: fix a bug in the handling of the
Location
element.
- Add definition for the
Preselection
element. - Add attributes
@byteRange
,@availabilityTimeOffset
and@availabilityTimeComplete
to BaseURL elements (pointed out by @ypo).
- Downloading: only download subtitles when
fetch_subtitles()
has been called on DashDownloader (from @sleepycatcoding). - Add derived PartialEq to data structures to allow for comparison.
- Parsing: certain MPDs including "overlapping" elements can now be parsed.
- Downloading: add support for saving media fragments to a user-specified directory, using new
function
save_fragments_to
onDashDownloader
. This may be useful to help debug issues with DASH streams or to extract additional information from fragmented MP4 segments. - Support for the DASH XML vocabulary associated with the SCTE-35 standard. This standard allows
dynamic insertion of alternate content (mostly used for advertising). Support is gated by the
new
scte35
feature, which is enabled by default. - Parsing of xs:datetime fields attempts to use the rfc3339 crate before falling back to the iso8601 crate if the datetime is not in RFC 3339 format (for example, if it doesn't include a timezone). The rfc3339 crate parses with nanosecond precision, whereas the iso8601 crate only has millisecond resolution.
- Downloading: fix an off-by-one error when calculating
$Number$ -based SegmentTemplate-based addressing (the initialization segment is now counted towards the total number of segments).
- Downloading: add preliminary support for throttling the network bandwidth, with method
with_rate_limit
on DashDownloader. - Add
@scanType
attribute to AdaptationSet nodes. - Add
@presentationDuration
to SegmentBase nodes. - Add
FailoverContent
element to SegmentBase nodes (from @sbuzzard).
- Serialization: default values for the XML namespaces for xlink, xsi, cenc, dvb and scte35 will be provided if they are not supplied explicitly. This should make it easier to generate standards-compliant manifests.
- Downloading: limit length of default output pathname (when using method
download
) to avoid exceeding filesystem limits.
- Downloading: add support for
MP4Box
as an external muxing tool. When built without libav support (the default configuration) and downloading to a path with ".mp4" extension, try to use theMP4Box
commandline application (from the GPAC suite) as a subprocess for muxing, if ffmpeg and VLC fail.MP4Box
is available for Linux and other Unixes, Microsoft Windows and MacOS. - New function
with_mp4box()
onDashDownloader
to allow the location of the MP4Box commandline application to be specified, if in a non-standard location. - New example
round_trip.rs
which can be used to check round trip from XML to Rust structs to XML. - Add
@startWithSAP
and@maximumSAPPeriod
attributes to AdaptationSet nodes. - Add
@timescale
attribute to SegmentList nodes. - Add
@numChannels
,@sampleRate
and@lang
attributes to Representation nodes. - Add
@sar
,@width
,@height
,@maximumSAPPeriod
and@startWithSAP
attributes to AdaptationSet nodes. - Add
EssentialProperty
andSupplementalProperty
node vectors to Representation and AdaptationSet nodes. - Add definition for
ProducerReferenceTime
nodes, used for low-latency streaming. - Add definition for
Switching
nodes, used for Adaptation Set switching. - Add definition for
InbandEventStream
nodes, used to signal presence of DASH event boxes in a media stream. - Add definition for
RepresentationIndex
nodes. - Add
@schemeIdUri
and@value
(deprecated) to Event nodes. - Add
scte214:ContentIdentifier
element to ProgramInformation nodes. - Add
@maxSubsegmentDuration
attribute to MPD nodes.
AdaptationSet.@id
changed from u64 to String type (breaking change).Period.@start
changed from a String to an xs:duration type (breaking change).ContentProtect.@cenc_pssh
changed from an Option to a Vec (breaking change).DashMpdError
enum made#[non_exhaustive]
(breaking change).- Fixed a bug in the parsing of xs:datetime attributes with fractional seconds.
- Fixed parsing of
@starttime
and@duration
attributes on Range elements. - Fixed XML namespace issues for attributes declared in the XLink, XMLSchema-instance, Common Encryption, DVB and SCTE-35 namespaces. These attributes should now be serialized correctly when generating an MPD.
- Add definition for
SubRepresentation
nodes. - Add definition for
Rating
nodes. - Add
@presentationTimeOffset
,@contentEncoding
and@messageData
attributes to Event nodes. The node content is available via thecontent
attribute. - Add
@availabilityTimeOffset
and@availabilityTimeComplete
to SegmentTemplate nodes (from @sbuzzard). - Add
@weight
attribute to BaseURL nodes. - Add
Role
,Rating
andViewpoint
content to ContentComponent and AdaptationSet nodes. - Add
Label
content to SubRepresentation and AdaptationSet nodes. - Add
SupplementalProperty
to Period nodes. - Add
@id
attribute to MPD nodes.
- Downloading: New option
max_error_count
on DashDownloader to specify the maximum number of non-transient network errors that should be ignored before a download is aborted. This is useful on some manifests using Time-based or Number-based SegmentLists for which the packager calculates a number of segments which is different to our calculation (in which case the last segment can generate an HTTP 404 error). - Serializing: the formatting of xs:duration attributes in generated XML has been improved to use nanosecond instead of millisecond precision, and to use minute and hour markers if relevant.
- Downloading: improve support for subtitles by making use of Representation.mimeType attributes
- New crate feature
native-tls
(enabled by default) which is passed through to thereqwest
crate. This change allows users to select between TLS support using the platform-native stack (native-tls
) and using therustls-tls
stack. - New crate feature
socks
(enabled by default) which is passed through to thereqwest
crate. It enables SOCKS5 proxy support for HTTP/HTTPS requests. - Add
@segmentProfiles
attributes to Representation and AdaptationSet nodes. - Add
@dependencyId
attribute to Representation nodes. - Add
@qualityRanking
attribute to Representation nodes. - Add
@indexRange
and@indexRangeExact
attributes to SegmentTemplate and SegmentList nodes. - Add definition for
Representation.FramePacking
nodes. - Add definition for
MPD.PatchLocation
nodes, that allow a DASH client to retrieve a patch from the server that contains a set of instructions for replacing certain parts of the MPD manifest with updated information. - Add definition (with correct capitalization) for
Metrics.Reporting
nodes.
- Downloading: use
Representation.qualityRanking
attribute, if present, to select representations according to user's quality preference. - Update dependency quick-xml to v0.28.
- Update dependency xattr to v1.0.
AudioChannelConfiguration
nodes in Representation and AdaptationSet changed from an Option to a Vec (they may be present multiple times).
- Add
EventStream
node to Period nodes (thanks to @noguxun). - Add
@maxPlayoutRate
,@profiles
and@codingDependency
attributes on Representation and AdaptationSet nodes. - New crate features
compression
,rustls-tls
andtrust-dns
to enable (pass through) the corresponding features on thereqwest
dependency. Otherwise, we use reqwest with its default feature set. Suggestion from @HoLLy.
- Fix download of media streams with
$Time
-basedSegmentTimeline
when initial@t
is non-zero. - Update dependency iso8601 to v0.6.
- The tokio crate is a dev-dependency rather than a full dependency (from @HoLLy).
- Downloading: switched to an asynchronous API. This will require code changes for clients.
Functions
download
anddownload_to
are nowasync
, and you will need to call them from an async context and use.await
(see the exampledownload_bbc.rs
for some sample code). If you are passing a reqwest client toDashDownloader
(usingwith_http_client
), you should now use a standardClient
built usingreqwest::Client::builder()
, instead of usingreqwest::blocking::Client::builder()
as previously (see the exampledownload_proxy.rs
for some sample code). Clients will need to add an explicit dependency on the tokio crate (which was already pulled in via the reqwest crate, but implicitly).
- Preliminary support for fetching subtitles (see function
fetch_subtitles
onDashDownloader
). There is support for subtitles in WebVTT format (an AdaptationSet node with a@mimeType
attribute of "text/vtt"), TTML (@mimeType
of "application/ttml+xml") and SAMI (@mimeType
of "application/x-sami"). There is also some support for WVTT (binary WebVTT in a wvtt box in fragmented MP4 container, as specified by ISO/IEC 14496-30:2014) and for STPP format (TTML in a fragmented MP4 container). WVTT subtitles will be converted to SRT format using the MP4Box commandline application, if it is available in the PATH.
- Update dependency quick-xml to v0.27
- Simplify serialization example using new version of the quick-xml crate.
- Fix: xs:datetime fields such as
MPD@publishTime
andMPD@availabilityStartTime
without a timezone are now parsed correctly instead of triggering an error. Issue seen with YouTube DASH manifests, reported by @erg43hergeg.
- Downloading: implement support for
SegmentURL@mediaRange
andInitialization@range
using HTTP byte range requests. This allows us to download crazy DASH manifests that misuse Twitter's CDN by prepending dummy PNG headers to media segments (https://twitter.com/David3141593/status/1587978423120666625). - Fixed default value for
SegmentTemplate@startNumber
when downloading (1 instead of 0). - Fix: an AdaptationSet may contain a SegmentList.
- We now check that the HTTP content-type of downloaded segments corresponds to audio or video content.
New function
without_content_type_checks
onDashDownloader
to disable these checks (may be necessary with poorly configured HTTP servers). - Added functions
keep_video
andkeep_audio
onDashDownloader
to retain video and audio streams on disk after muxing. - Added attribute
Representation@mediaStreamStructureId
. - Added attribute
SegmentTemplate@eptDelta
.
- Support for data URLs in initialization segments (per RFC 2397).
- API change: rationalize struct field types: fields that were of type Option<Vec<>> (such as MPD.Periods and Period.Representations) become Vec<> in the serialized representation. If none present, the vector is empty. This simplifies iteration over their contents. Some items such as BaseURL that can appear multiple times changed to Vec<> instead of Option<>.
- Add missing
Event@presentationTime
attribute. - Add missing
AdaptationSet > Label
node type. - Add missing
AdaptationSet@selectionPriority
attribute.
- Serialization support to allow programmatic generation of an MPD manifest (in XML format) from Rust
structs. See
examples/serialize.rs
for some example code.
- New functions
with_vlc()
andwith_mkvmerge()
onDashDownloader
to allow the location of VLC and mkvmerge applications to be specified, if in a non-standard location. Aligns with the existing functionality to specify the location of the ffmpeg binary.
- The default path for the external muxing applications now depends on the platform (for instance "ffmpeg.exe" on Windows and "ffmpeg" elsewhere).
- The
download_to()
function returns the path that the media was downloaded to, instead of()
.
- API change: reworked the error handling using an error enumeration DashMpdError and the
thiserror
crate, instead of theanyhow
crate. This allows clients of the library to handle errors depending on their type (I/O, network, parsing, muxing, etc.). - Update required version of chrono crate to resolve security vulnerability RUSTSEC-2020-0159.
- Download support is conditional on the
fetch
crate feature being enabled (which is the default configuration). Disabling it reduces code size and the number of dependencies pulled in.
- Downloading: add support for
mkvmerge
as an external muxing tool. When built without libav support (the default configuration) and downloading to a path with ".mkv" extension, try to usemkvmerge
(from the MkvToolnix suite) as a subprocess for muxing, before falling back toffmpeg
.mkvmerge
will generate files in a Matroska container, which allows more codec flexibility than MPEG-4.mkvmerge
is available for Linux and other Unixes, Microsoft Windows and MacOS. - Add support for manifests containing a
Location
node. This allows the server to specify a new URL from which the client should request an updated manifest (similar to an HTTP redirect). - Change type of some attributes specified to be of type
xs:dateTime
to anXsDatetime
instead of an unserialized String, using serde support in the chrono crate (@publishTime, @availabilityStartTime, @availabilityEndTime). - Change type of some attributes specified to be of type
xs:duration
to aDuration
instead of an unserialized String (@minBufferTime, @minimumUpdatePeriod, @timeShiftBufferDepth, @mediaPresentationDuration, @suggestedPresentationDelay).
- Downloading: functions
audio_only
andvideo_only
on DashDownloader allow the user to fetch only the audio stream, or only the video stream (for streams in which audio and video content are available separately). - Downloading: function
prefer_language
on DashDownloader allows the user to specify the preferred language when multiple audio streams with different languages are available. The argument must be in RFC 5646 format (e.g. "fr" or "en-AU"). If a preference is not specified and multiple audio streams are present, the first one listed in the DASH manifest will be downloaded.
- Downloading: support for sleeping between network requests, a primitive mechanism for throttling
network bandwidth consumption (function
sleep_between_requests
on DashDownloader).
- Fixes to allow download of DASH streams with SegmentList addressing where the
SegmentURL
nodes useBaseURL
instead of@media
paths (e.g. http://download.tsi.telecom-paristech.fr/gpac/DASH_CONFORMANCE/TelecomParisTech/mp4-main-single/mp4-main-single-mpd-AV-BS.mpd) - Downloading: muxing using VLC should now work correctly.
- Downloading: improve handling of transient and permanent HTTP errors.
- An
AdaptationSet
node may contain multipleContentComponent
nodes. - Optional fields
frameRate
andsar
added toRepresentation
nodes. - Implement our own parser for ISO 8601 durations to avoid bugs in the iso8601 crate. This fixes download support for several video publishers (content previously handled as if it had zero length, due to this parsing bug).
- Optional
SegmentTemplate@duration
field changed from u64 to f64 type. It is specified to be an unsigned int, but some manifests in the wild use a floating point value (e.g. https://dash.akamaized.net/akamai/bbb_30fps/bbb_with_multiple_tiled_thumbnails.mpd).
- Function
with_ffmpeg
on DashDownloader allows the user to specify the location of the ffmpeg binary to use for muxing (useful if it's not in the PATH). - Optional field
ContentProtection
added to theAdaptationSet
node type. - Add optional field
cenc_pssh
toContentProtection
nodes.
- Function
add_progress_observer
on DashDownloader provides support for implementing progress bar, using the observer pattern. - Function
verbosity
on DashDownloader provides support for setting the level of verbose messages concerning the progression of the download. - Function
record_metainformation
controls whether metainformation such as the origin URL are recorded in the output file as extended attributes.
- fetch_mpd() function now takes only a single DashDownloader argument.
- Downloading: move to a builder pattern with DashDownloader API. The function
fetch_mpd
should now be considered internal. - Downloading: preference for quality/bitrate can be specified.
- Downloading: fix use of SegmentTemplate
@startNumber
attribute. - Downloading: fix regression concerning streams that use a SegmentTimeline.
- Path fixes to allow tests and examples to run on Windows.
- Downloading: support multi-period MPD manifests.
- Downloading: support remote resources using XLink (
xlink:href
attributes). - The
id
andbandwidth
attributes of aRepresentation
node are now optional (for XLink support).
- Downloading: fix handling of manifests with negative
@r
attribute onS
nodes. - Downloading: fix handling of manifests with segment templates that use
$Bandwidth$
.
- Add support for using ffmpeg or vlc as a subprocess for muxing, rather than ffmpeg's libav library. This is more robust on certain invalid media streams and may be easier to build on certain platforms. Support is gated by the "libav" feature.
- When using libav (ffmpeg as a library), errors and informational messages from ffmpeg will be logged at info level.
- The
serviceLocation
attribute onBaseURL
nodes is now public. - The
media
attribute onSegmentTemplate
nodes is now an optional field (it was previously a required field). - The
actuate
(xlink:actuate) attribute onPeriod
nodes is now of typeOption<String>
(previouslyOption<bool>
). - On platforms that support extended filesystem attributes, write the origin MPD URL to attribute
user.xdg.origin.url
on the output media file, using thexattr
crate, unless the URL contains sensitive information such as a password. Likewise, write any MPD.ProgramInformation.{Title, Source, Copyright} information from the MPD manifest to attributes user.dublincore.{title, source, rights}. - Downloading: improve handling of transient HTTP errors.
- Downloading: improve support for certain stream types.
- Initial release.