Skip to main content

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, and bkt-v2.1 schemas)

Requirements

  • Python 3.10 or higher (up to 3.13)
  • MediaInfo installed on the system (required by pymediainfo for 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 fixtures
  • tests/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

Metadata

Release files for media-muncher 2.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for media-muncher 2.2.0
File Size Uploaded
media_muncher-2.2.0.tar.gz 37.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for media-muncher 2.2.0
File Interpreter ABI Platform
media_muncher-2.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 88.0 kB

Release files / media_muncher-2.2.0.tar.gz

Download URL media_muncher-2.2.0.tar.gz
Size 37.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c805367249c1d1a5250f72fc3660e131044d5cb31fa0133398c04b78aafc5eb0
BLAKE2b-256 checksum
How to use checksums
4b47ecf6e20e77cea879b9945aa87ce334728cad69546e5e0fa89cf3eee40d78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.13.11 Darwin/24.6.0

Release files / media_muncher-2.2.0-py3-none-any.whl

Download URL media_muncher-2.2.0-py3-none-any.whl
Size 50.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1bf08061a331d89f498339f29a1510a5f6c1087f8133d4ec58341612f037ea35
BLAKE2b-256 checksum
How to use checksums
fae2823fea7ee46939a5f56e3e10a9aad0ce3bc6e2dc47f0cc49eef1a1d023fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.13.11 Darwin/24.6.0

Release history Release notifications | RSS feed

This release

2.2.0 This release

2 release files

2.1.0

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.7.2

2 release files

1.7.1

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page