Open
Description
It can be useful to allow the user to read and modify the MPD manifest before downloading media segments from it. Use cases:
- print additional diagnostics concerning the manifest
- delete some Periods that the user is not interested in (based for example on their duration)
- delete Representations that use undesired codecs
- modify the BaseURL to include another CDN
- delete all subtitle languages and formats except for the one the user is interested in (as a complement to the prefer_language functionality)
- delete audio Representations whose language the user is not interested in
- drop an audio AdaptationSet if the user only is interested in video (though this functionality is already built in to the library)
As of 2023-10-22 we have implemented support for XSLT stylesheets via xsltproc, which allows XML rewriting. This is a standards-based and easy to implement solution to filtering/rewriting, but xsltproc only supports XSLT v1.0 (v3.0 is more flexible and for example includes functions for manipulating xs:duration attributes) and XSLT is not the most widely adopted language.
Possible alternatives:
- Saxon-HE, free Java software (MPL v2) which implements XSLT 3.0
- A generic filter interface implemented as a pipe
- A command API that takes two filename arguments
- A WebAssembly-based interface that could be implemented in any programming language that can generate WASM bytecode
I will be thinking about implementing some of these in the next few months.