Skip to main content

Convert DASH (MPD) manifests to HLS (M3U8) playlists.

Project description

PyDash2HLS

License Release Latest Version

PyDash2HLS is a Python library that converts DASH (MPD) manifests into HLS (M3U8) playlists. It supports both local and remote DASH manifests, handles fragment extraction, and optionally embeds SAMPLE-AES encryption keys for protected content.

Features

  • Parse DASH MPD files (local or remote)
  • Extract video/audio profiles and fragment URLs
  • Handle DRM information (Widevine & PlayReady)
  • Convert DASH profiles to HLS playlists (.m3u8)
  • Optional embedding of encryption keys in HLS (SAMPLE-AES-CTR)
  • Works with ffplay or any HLS-compatible player
  • Lightweight and Python-only solution

Installation

Install via pip:

pip install pydash2hls

Usage

Load a DASH Manifest

From a Remote URL

from pydash2hls.dash import Dash

url = "https://cdn.bitmovin.com/content/assets/art-of-motion_drm/mpds/11331.mpd"
dash = Dash.remote(method='GET', url=url)

From a Local File

from pathlib import Path
from pydash2hls.dash import Dash

file_path = Path("11331.mpd")
dash = Dash.load(file_path)
dash.url = "https://cdn.bitmovin.com/content/assets/art-of-motion_drm/mpds/11331.mpd"

Parse Fragments and DRM

dash.unpack()  # Extracts profiles, fragments, and DRM info into dash.profiles

Convert DASH to HLS

profile_id = "1080_4800000"  # Video profile ID
encryption_key = "KID:KEY"  # Optional SAMPLE-AES-CTR key

hls_playlist = dash.convert(profile_id=profile_id, encryption_key=encryption_key)

# Save HLS playlist to disk
Path("index.m3u8").write_text(hls_playlist)

Play the Generated Playlist

ffplay -hide_banner -loglevel error -allowed_extensions ALL -protocol_whitelist file,http,https,tcp,tls,crypto,data index.m3u8

Contributors

hyugogirubato robinroy03

Licensing

This project is licensed under the GPL v3 License. You can find a copy of the license in the LICENSE file in the root folder.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydash2hls-3.0.0.tar.gz (20.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydash2hls-3.0.0-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

Details for the file pydash2hls-3.0.0.tar.gz.

File metadata

  • Download URL: pydash2hls-3.0.0.tar.gz
  • Upload date:
  • Size: 20.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.11 Windows/10

File hashes

Hashes for pydash2hls-3.0.0.tar.gz
Algorithm Hash digest
SHA256 bc16044cd18634f71bfff36382495c9ce729de62ddb02520d8f9ee54599e6ce7
MD5 0f65b1bd6ae66f070fba1fcd2edb29c6
BLAKE2b-256 9da8551ddd2df8e6274662178e39ff059ce797dff1f63998c170b3ae752927a8

See more details on using hashes here.

File details

Details for the file pydash2hls-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: pydash2hls-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 20.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.11 Windows/10

File hashes

Hashes for pydash2hls-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4fa03a0c74ce0c2b1f6645d6668a995b54fd5db8fa42f217621045e39c0411a1
MD5 74d938b7d05f4d67724256fa175e5994
BLAKE2b-256 bfc902c65af80798e3de7f61fa9ebe03787ffeeee66e2d7a64b5b9c047dda2b8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page