A module to work with media assets, in particular DASH and HLS streams
Project description
media-muncher
A Python library for working with media assets, in particular DASH and HLS streams.
Features
- Content handlers — Fetch and parse HLS, DASH, VAST, VMAP, and static media (JPEG, PNG, MP4)
- Stream analysis — Extract renditions, packaging info, and timeline data from HLS/DASH manifests
- Metadata extraction — Summarise manifests as features, structure, facets, or plain-text digests
- HLS download — Offline download of HLS streams with parallel segment fetching
- Encoding utilities — Frame rates, resolutions, H.264 level validation, GOP sizing, segment duration math
- HLS compatibility — Compare renditions between two HLS sources by codec strings
- Transcoding profiles — Pluggable schema system to build transcoding profiles from analysed streams (currently ships with Broadpeak.io
bkt-v1,bkt-v2, andbkt-v2.1schemas)
Requirements
- Python 3.10 or higher (up to 3.13)
- MediaInfo installed on the system (required by
pymediainfofor segment probing when manifest metadata is incomplete)
Installation
From PyPI
pip install media-muncher
Monorepo development
From the repository root, use the unified dev environment (build order: mpd-inspector → media-muncher → SDK → CLI):
python3 build-scripts/setup-unified-env.py
Quick example
Fetch and inspect a stream:
from media_muncher.handlers import factory
handler = factory.create_handler("https://example.com/main.m3u8")
print(handler.document)
print(handler.extract_features())
Analyse renditions and optionally generate a transcoding profile:
from media_muncher.handlers.hls import HLSHandler
from media_muncher.analysers.hls import HlsAnalyser
from media_muncher.profile import ABRProfileGenerator
handler = HLSHandler(url="https://example.com/main.m3u8")
analyser = HlsAnalyser(handler)
renditions = analyser.extract_renditions()
packaging = analyser.extract_packaging_info()
# Schema is pluggable; bkt-v2.1 is the current built-in schema
profile = ABRProfileGenerator(schema="bkt-v2.1", preset="VERYFAST").generate(
renditions, packaging, name="MyProfile"
)
Documentation
Full documentation is available as an MkDocs site in this package:
cd media-muncher
poetry install
poetry run mkdocs serve
Then open http://127.0.0.1:8000.
See the docs/ directory for guides and API reference.
Development
Run tests from the media-muncher/ directory:
poetry install
poetry run pytest
Test layout:
tests/dimensions/— Unit tests for encoding math (FrameRate,Resolution, H.264 levels, GOP/segment sizing)tests/profile_generator/— End-to-end profile generation against local manifest fixturestests/test_file_handlers.py— Handler factory and content-type detection (requires network)tests/manifest_samples/— HLS/DASH manifest fixtures used by profile tests
Build documentation:
poetry run mkdocs build
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file media_muncher-2.2.0.tar.gz.
File metadata
- Download URL: media_muncher-2.2.0.tar.gz
- Upload date:
- Size: 37.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.13.11 Darwin/24.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c805367249c1d1a5250f72fc3660e131044d5cb31fa0133398c04b78aafc5eb0
|
|
| MD5 |
56d5695cc81fbc216acf047cb8827fb7
|
|
| BLAKE2b-256 |
4b47ecf6e20e77cea879b9945aa87ce334728cad69546e5e0fa89cf3eee40d78
|
File details
Details for the file media_muncher-2.2.0-py3-none-any.whl.
File metadata
- Download URL: media_muncher-2.2.0-py3-none-any.whl
- Upload date:
- Size: 50.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.13.11 Darwin/24.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1bf08061a331d89f498339f29a1510a5f6c1087f8133d4ec58341612f037ea35
|
|
| MD5 |
8b80fe7dde8eebb996c12a8b5707ecba
|
|
| BLAKE2b-256 |
fae2823fea7ee46939a5f56e3e10a9aad0ce3bc6e2dc47f0cc49eef1a1d023fa
|