Skip to main content

Download HLS video streams and split videos into PNG-wrapped fragments

Project description

streambud

Work with HLS video streams and PNG-wrapped fragments.

streambud download <playlist.m3u8> [output.mp4]   Download HLS → MP4
streambud split    <video> [duration] [out_dir]    Split video → PNG-wrapped TS fragments + M3U8
streambud assemble <dir|playlist.m3u8> [output]    Assemble fragments → MP4

Commands

download

Downloads segments from an M3U8 playlist, strips PNG wrappers, and concatenates into an MP4.

streambud download [-w N] [-b URL] [-ss TIME] [-to TIME] <playlist.m3u8> [output.mp4]
  • Master playlist support — interactively pick resolution/bitrate
  • Parallel downloads (default 10 workers, set with -w)
  • Resume — skips already-downloaded .ts fragments on re-run
  • Retries failed segments up to 3 times
  • Trim with -ss/-to (ffmpeg time format, e.g. 00:01:30 or 90)
  • Handles Google Drive PNG-wrapped segments (strips the PNG container)

split

Splits a video into MPEG-TS segments and wraps each in a minimal valid PNG (1×1 white pixel, Google Drive style). Writes a playlist.m3u8 compatible with download.

streambud split <video> [segment_duration=10] [output_dir=png_fragments]
  • Uses ffmpeg's segment muxer (-c copy, no re-encode)
  • Each segment = PNG header + IEND chunk + raw TS data
  • Output M3U8 ready for upload to Google Drive or streambud download

assemble

Converts PNG-wrapped .ts fragments back into a playable MP4. Accepts a directory of fragments or an M3U8 playlist.

streambud assemble [-ss TIME] [-to TIME] <fragments_dir|playlist.m3u8> [output.mp4]
  • Strips PNG wrappers before concatenation
  • Two-step trim (-ss/-to): concat all → trim result (avoids concat demuxer timestamp issues)

Requirements

  • curl
  • ffmpeg (concat demuxer + segment muxer)
  • Python 3.10+

Install

pip install streambud              # from PyPI
pip install git+https://github.com/<user>/streambud   # directly from GitHub

Or use without install:

export PYTHONPATH=src
python3 -m streambud download ...

Development

# Tests
python3 -m unittest tests/test_streambud.py -v

# Linting & formatting
python3 -m venv .venv
.venv/bin/pip install ruff pre-commit
.venv/bin/pre-commit install   # runs ruff + tests on every commit

CI/CD

Push a version tag to trigger publish to PyPI:

git tag v0.1.0
git push origin v0.1.0

Requires a PYPI_TOKEN secret set in GitHub repo settings (Settings → Secrets and variables → Actions).

Architecture

src/streambud/
├── __init__.py    # Public API exports
├── __main__.py    # CLI entry point (python -m streambud)
├── download.py    # HLS download + PNG stripping + ffmpeg concat
├── split.py       # Video → PNG-wrapped fragments
└── assemble.py    # Fragments → MP4 reassembly

.github/workflows/
├── ci.yml         # Lint + test on every push
└── publish.yml    # Build + publish to PyPI on tags

All modules use only Python stdlib — no external PyPI dependencies.

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

streambud-0.1.0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

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

streambud-0.1.0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file streambud-0.1.0.tar.gz.

File metadata

  • Download URL: streambud-0.1.0.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for streambud-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d084043d6a5c07ad4df84135acbe08039539948f23ec600d76113c4287e8d99d
MD5 12a9d02b038201599c54f2e5192173b6
BLAKE2b-256 6f3224d730d1587e4f5c672490aa94103532f196054c098e0b67768caaa46019

See more details on using hashes here.

File details

Details for the file streambud-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: streambud-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for streambud-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5513312ce8cb1674f6d85dc4efaf0d99d7e4121f56a6a908765212f648aecbbe
MD5 746959d0dcb83befb31146cadd3ef0dc
BLAKE2b-256 5736a429b6d82965851e30f51f851cb8293fb3e679e1ebc878f2a7a9a1418b65

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