gst-flexhlssink-rs/README.md

46 lines
1.7 KiB
Markdown
Raw Normal View History

2021-05-12 09:26:33 +00:00
# GStreamer HTTP Live Streaming Plugin
A highly configurable GStreamer HLS sink plugin. Based on the [`hlssink2`](https://gstreamer.freedesktop.org/documentation/hls/hlssink2.html?gi-language=c) element. The `flexhlssink` is written in Rust and has various options to configure the HLS output playlist generation.
2021-05-14 14:44:57 +00:00
## Development status
The plugin is in **active development**. The first release objective is to have full feature parity with the `hlssink2` plugin.
Progress:
- [x] Support all properties exposed by the `hlssink2` plugin;
- [x] Write TS content to fragment stream (defaults to filesystem);
2021-05-14 16:48:55 +00:00
- [x] Write HLS playlist m3u8 file;
2021-05-16 16:20:12 +00:00
- [x] Delete old fragments;
2021-05-17 19:35:11 +00:00
- [x] Signal to acquire fragment stream;
- [x] Signal to acquire HLS playlist stream;
- [x] Signal to delete a fragment file;
2021-05-14 21:04:23 +00:00
## Example Usage
After [installing GStreamer](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs#installation)
, it is possible to compile and run the `flexhlsplugin`.
```bash
2021-05-14 21:13:54 +00:00
cargo build --release
2021-05-14 21:04:23 +00:00
```
2021-05-14 21:06:01 +00:00
On MacOS it might be necessary to set the `PKG_CONFIG_PATH` environment variable:
```bash
2021-05-14 21:04:23 +00:00
export PKG_CONFIG_PATH="/Library/Frameworks/GStreamer.framework/Versions/Current/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
An example pipeline:
2021-05-14 21:06:01 +00:00
```bash
2021-05-14 21:04:23 +00:00
export PROJECT_DIR=`pwd`
gst-launch-1.0 videotestsrc is-live=true ! \
x264enc ! h264parse ! flexhlssink target-duration=4 \
2021-05-14 21:13:54 +00:00
--gst-plugin-load=${PROJECT_DIR}/target/release/libflexhlssink.dylib
2021-05-14 21:04:23 +00:00
```
In another terminal run a simple HTTP server:
2021-05-14 21:06:01 +00:00
```bash
2021-05-14 21:04:23 +00:00
cd $PROJECT_DIR
python simple_http.py
```
2021-05-14 23:29:59 +00:00
Open the example player site https://hls-js.netlify.app/demo/ and play the `http://localhost:8000/playlist.m3u8` playback URL.