PyDash2HLS is a Python library for converting DASH (Dynamic Adaptive Streaming over HTTP) manifest files to HLS (HTTP Live Streaming) format.
- Convert MPD files to HLS format.
- Support for remote and local MPD files.
- Retrieve media URLs for a specific profile.
- Handle DRM (Digital Rights Management) information in MPD files.
You can install PyDash2HLS using pip:
pip install pydash2hls
To initialize the Converter class, you can use the following methods:
from pydash2hls import Converter
# Initialize Converter from a remote URL
url = "http://example.com/manifest.mpd"
converter = Converter.from_remote(url)
from pydash2hls import Converter
from pathlib import Path
# Initialize Converter from a local file
file_path = Path("path/to/manifest.mpd")
converter = Converter.from_local(file_path)
To build an HLS manifest for a specific profile, you can use the build_hls()
method:
# Build HLS manifest for a profile
profile_id = "profile1"
hls_manifest = converter.build_hls(profile_id)
To retrieve a list of media URLs for a specific profile, you can use the media_urls()
method:
# Get media URLs for a profile
profile_id = "profile1"
media_urls = converter.media_urls(profile_id)
The following exceptions can be raised by PyDash2HLS:
InvalidPath
: Raised when the file path is invalid.InvalidFileContent
: Raised when the contents of the file are not in DASH format or are incompatible.InvalidProfile
: Raised when the selected profile is invalid.MissingRemoteUrl
: Raised when a remote file URL is required but not provided.
This project is licensed under the GPL v3 License.