No description
  • Shell 88.1%
  • Nix 10.4%
  • Dockerfile 1.5%
Find a file
Alan Pope 0eba5601d7
feat: Add snap support (#23)
* WIP: snapcraft config

* chore: tidy up snap workflow

* fix: update ld_library_path

* fix the version of the snap

This uses a combination of most recent git tag and short rev.

* Add git as a build package

Required because we have a dump plugin and a nill plugin which pull in next to nothing. Making it hard to do a version stamp without the git command
2024-07-24 19:23:58 +01:00
.github feat: Add snap support (#23) 2024-07-24 19:23:58 +01:00
debian chore: update packaging and docs to remove procps 2024-07-23 16:35:45 +01:00
snap feat: Add snap support (#23) 2024-07-24 19:23:58 +01:00
.envrc feat: add nix flake 2024-07-22 12:33:01 +01:00
.gitignore feat: add nix flake 2024-07-22 12:33:01 +01:00
CODE_OF_CONDUCT.md docs: add initial project documentation and templates 2024-07-22 13:04:52 +01:00
Containerfile ci: add build container image 2024-07-24 02:03:58 +01:00
CONTRIBUTING.md fix: correct URLs to the project 2024-07-23 00:43:17 +01:00
devshell.nix chore: update packaging and docs to remove procps 2024-07-23 16:35:45 +01:00
flake.lock feat: add nix flake 2024-07-22 12:33:01 +01:00
flake.nix feat: add nix flake 2024-07-22 12:33:01 +01:00
LICENSE Initial commit 2024-07-22 09:35:59 +01:00
package.nix chore: update packaging and docs to remove procps 2024-07-23 16:35:45 +01:00
README.md docs: update README with details about using the container 2024-07-24 02:03:58 +01:00
SECURITY.md fix: correct URLs to the project 2024-07-23 00:43:17 +01:00
stream-sprout fix: do not build STREAM_TEE inside a subshell. fixes #25 2024-07-24 18:06:43 +01:00
stream-sprout.yaml.example docs: improve yaml examples 2024-07-23 12:32:49 +01:00

Stream Sprout

Stream Sprout

Restream a video source to multiple destinations such as Twitch, YouTube, Owncast and Peertube

Made with 💝 for Tux (Linux) & Apple (macOS)

 Discord   Mastodon   Twitter   LinkedIn 

Introduction

Stream Sprout 🌱 is a simple, self-contained, and easy-to-use solution for streaming to multiple destinations such as Twitch, YouTube, Owncast and Peertube 📡

Stream Sprout

It uses FFmpeg to receive the video stream from OBS Studio (or anything that can publish a RTMP stream) and then restreams it to multiple destinations; providing similar functionality as services like Restream.io and Livepush.io but without the need to pay 💸 for a third-party service or run something like nginx with the RTMP module.

Stream Sprout is configured with a simple YAML file and designed to be run on the same computer as your OBS Studio instance (it can be run remotely too) and does not require root privileges.

There is no transcoding or processing of the video stream 🎞️ The stream is received and then restreamed to the destinations you configure without modification. Optionally you can also archive the stream to disk 💾

While the restreaming process is lightweight, your bandwidth requirements will increase with each destination you add. 📈 Ensure you have sufficient bandwidth to support the number of destinations you intend to stream to ⤴️

Stream Sprout is developed on Linux 🐧 and should work on macOS 🍏 or any other platform that supports bash and ffmpeg 👍

Get Started

  • Install Stream Sprout 🧑‍💻
  • Configure Stream Sprout 🧑‍💻
  • Configure OBS Studio 🎛️
  • Start stream-sprout ⌨️
  • Click the Start Streaming button in OBS Studio 🖱️
  • Do you your thing 🎥
  • Click the Stop Streaming button in OBS Studio 🖱️
  • Ctrl + C to stop stream-sprout ⌨️

Installation

Debian

  • Download the Stream Sprout .deb package from the releases page 📦
  • Install it with apt-get install ./stream-sprout_0.1.4-1_all.deb.

macOS

Install the Stream Sprout requirements using brew:

brew install bash ffmpeg

Now clone the project:

git clone https://github.com/wimpysworld/stream-sprout.git
cd stream-sprout

Nix & NixOS

FlakeHub

Stable releases of Stream Sprout are published to FlakeHub for Nix users ❄️ See the flake on FlakeHub for more details:

Ubuntu

  • Download the Stream Sprout .deb package from the releases page 📦
  • Install it with apt-get install ./stream-sprout_0.1.4-1_all.deb.

Docker & Podman

Pull the container

The Stream Sprout container image is available from the GitHub Container Registry. To pull the latest container image:

docker pull ghcr.io/wimpysworld/stream-sprout:latest

Or if you want a specific version:

docker pull ghcr.io/wimpysworld/stream-sprout:0.1.4

Run the container

The stream-sprout.yaml configuration file will be on the host computer so you need mount a volume to access it from the container.

If you have already pulled the container image, you can run Stream Sprout with:

docker run -p 1935:1935 -it -v $PWD:/data stream-sprout --config /data/stream-sprout.yaml

If you have not pulled or built the container image, you can run Stream Sprout with:

docker run -p 1935:1935 -it -v $PWD:/data ghcr.io/wimpysworld/stream-sprout:latest --config /data/stream-sprout.yaml
  • The -p 1935:1935 part will expose the RTMP server port 1935 on the host computer.
    • If you have configured Stream Sprout to use a different port, you should change the port number here too.
  • The -it options will run the container in interactive mode.
  • The -v $PWD:/data part will mount your current directory $PWD as /data within the container, allowing you to access your files using the /data path.

Build the container

Build the Stream Sprout container image:

docker build -t stream-sprout .

From source

You need to have FFmpeg on your system.

git clone https://github.com/wimpysworld/stream-sprout.git
cd stream-sprout

Configure Stream Sprout

Copy the example Stream Sprout configuration and edit it to suit your needs 📝

You can specify the configuration file to use with the --config <path> option. If you don't specify a configuration file, Stream Sprout will look for a configuration file in the following locations, in this order:

  • Current working directory ./stream-sprout.yaml
  • XDG configuration directory $XDG_CONFIG_HOME/stream-sprout.yaml (Linux) or ~/.config/stream-sprout.yaml (macOS)
  • /etc/stream-sprout.yaml

Server

server:
  url: "rtmp://127.0.0.1:1935"
  key: "create your key with uuidgen here"
  archive_stream: false
  archive_path: "${HOME}/Streams"

The server: section is used to configure the RTMP server that Stream Sprout creates; it must be an RTMP URL. The default port for RTMP is 1935, but you can use any port you like. If you remotely host Stream Sprout, you should use an IP address in the url: that accessible by your computer that runs OBS Studio and also set key: to a secure value to prevent unauthorized access. Running uuidgen will generate a suitable value.

If archive_stream: is true Stream Sprout will archive the stream to disk in the directory specified by archive_path:. If archive_path: is not accessible, Stream Sprout will fallback to using the current working directory.

Here's an example configuration for the Stream Sprout server: section.

Services

services: are arbitrarily named. Just create an entry for each RTMP destination you want to stream to. The example configuration includes entries for Trovo, Twitch, and YouTube but any RTMP destination can be added.

services:
  my-rtmp-destination:
    enabled: true
    rtmp_server: "rtmp://rtmp.example.com/live/"
    key: "my_super_secret_stream_key"

Twitch

Here's an example configuration for Twitch.

services:
  twitch:
    enabled: true
    rtmp_server: "rtmp://live.twitch.tv/app/"
    key: "your_twitch_stream_key"

Ingest servers

The example configuration uses the primary Twitch ingest endpoint, which is rtmp://live.twitch.tv/app/. If you want to optimize your stream latency, you can use a Twitch ingest endpoint closer to your location. A short list of recommended endpoints, based on your whereabouts, is available from Recommended Ingest Endpoints For You.

You can find a complete list of Twitch ingest endpoints from https://twitchstatus.com/.

Testing

If you want to test streaming to Twitch without going live, you can use the ?bandwidthtest=true query parameter.

Add ?bandwidthtest=true to the end of your Twitch stream key, this will enable bandwidth testing, which you can monitor using https://inspector.twitch.tv/, and the stream will not go live on your channel.

YouTube

Here's an example configuration for YouTube.

services:
  youtube:
    enabled: true
    rtmp_server: "rtmp://a.rtmp.youtube.com/live2/"
    key: "your_youtube_stream_key"

Configure OBS Studio

  • Open OBS Studio
  • Go to Settings > Stream
  • Select Custom from the Service dropdown
  • Copy the server url: from your Stream Sprout configuration to the Server field:
    • rtmp://127.0.0.1:1935 (default)
  • Copy the key: (if you specified one) from your Stream Sprout configuration to the Stream Key field

OBS Studio Stream Settings

Limitations

  • Stream Sprout does not support secure RTMP (RTMPS) at this time.
    • At least I don't think it does, but I haven't fully tested it.
  • Each destination you add will increase your bandwidth requirements.

References

These are some of the references used to create this project: