Skip to main content

Command line tools for HLS manipulation at origin or edge server

Project description


This package contains useful scripts to manipulate HLS manifests at origin or edge server.




Create a VOD playlist between two timestamps in a LIVE playlist


Create a LIVE playlist from a set of VOD playlists


Create a LIVE playlist from a specific starttime in another LIVE playlist


These scripts are based on the assumption that all HLS manifest files and segments are archived at the origin server where these scripts are executed. The archive for a specific live stream contains the history for all HLS manifest updates. For example:

Live HLS stream called ‘foo’ is archived in the directory /archive/foo on the server. It contains all updated HLS manifest files with a unix timestamp when it was last updated.


All video segments are also stored in the same directory.


From source

git clone
cd hls-origin-scripts
python install

From Python Package Index

pip install hlsorigin


These scripts are executed by the request handler at the origin webserver. The scripts output the generated manifest file to stdout


Generate a VOD playlist from a LIVE HLS where segments and manifest files are archived at /hlsarchive/stream/. A 20 minutes VOD manifest from 11:45 to 12:05 is created in this case.

hls-capture /hlsarchive/stream/ --mediaplaylist master800.m3u8 --in "2016-09-04 11:45:00" --out "2016-09-04 12:05:00"

By default any cueout periods (e.g. ads) are removed and a discontinuity tag is added in the generated manifest. Available options:

--help                  show help message and exit
--in TS             YYYY-mm-dd HH:MM:SS
--out TS                YYYY-mm-dd HH:MM:SS
--mediaplaylist PL  name of media playlist
--noremovecueout        do not remove segments in cue out periods


Generate a new LIVE HLS playlist with a new start position. This is useful when needing a startover functionality but the user should not be able to watch before the startover position.

hls-startover /hlsarchive/stream/ --mediaplaylist master800.m3u8 --startover "2016-09-04 16:25:00"

Available options:

--help                  show help message and exit
--mediaplaylist PL  name of media playlist
--startover TS      YYYY-mm-dd HH:MM:SS




We welcome contributions to this project. Just follow the normal procedures by forking this repository, create a topic branch for your fix and then submit a pull request.


See LICENSE for details

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

hlsorigin-0.0.16.tar.gz (5.3 kB view hashes)

Uploaded Source

Built Distribution

hlsorigin-0.0.16-py2-none-any.whl (9.0 kB view hashes)

Uploaded Python 2

Supported by

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