Skip to content

Repository files navigation

owncast-stream

A small Rust/GStreamer streamer for Owncast. It keeps one RTMP connection open while switching between a generated lobby and queued videos.

TUI Demo

Features

  • 1920x1080 H.264 video at 30 fps
  • AAC audio with an 80 Hz high-pass filter and dynamic compression
  • Preferred English audio
  • Embedded non-SDH English subtitles, with external subtitles used only as a fallback
  • Continuous lobby and playlist handoffs without reconnecting viewers
  • Persistent editable playlist with automatic track advancement
  • Repeatable startup queue entries and an in-terminal file chooser
  • Previous and next track controls
  • Pause with a frozen movie frame and silence while the RTMP stream stays live
  • 30-second forward and backward seeking
  • Amber projection-console TUI with playback status, gain, and stereo peak meters
  • Owncast title updates through a native Rust HTTP client
  • Clean lifecycle messages

Requirements

  • Rust 1.92 or newer
  • GStreamer 1.28 development files
  • GStreamer base, good, bad, ugly, and libav plugins
  • Owncast reachable over RTMP and its integration API

The stream key and title integration token are read from:

/opt/owncast/stream-key
/opt/owncast/title-token

Build and install

cargo build --release --locked
sudo install -m 0755 target/release/owncast-stream /usr/local/bin/owncast-stream

Usage

owncast-stream [OPTIONS] VIDEO [SUBTITLES] [TITLE]
owncast-stream movie-one.mkv --queue movie-two.mkv --queue movie-three.mkv

By default, the streamer publishes to the local Owncast instance and reads its credentials from the files listed above. To publish to a remote instance, provide its RTMP publish URL, stream-title integration endpoint, and credentials:

owncast-stream \
  --rtmp-url rtmp://owncast.example/live \
  --api-url https://owncast.example/api/integrations/streamtitle \
  --stream-key "$STREAM_KEY" \
  --api-key "$TITLE_TOKEN" \
  movie.mkv

The RTMP URL should omit the stream key; owncast-stream appends the value of --stream-key. All four options may also be used independently, so a remote server can still use credentials read from the default files.

The external subtitle file is used only when the video has no non-SDH embedded English subtitle stream.

Controls:

  • Enter starts the first pending track from the lobby.
  • Space pauses or resumes playback.
  • Left and Right seek backward or forward 30 seconds.
  • Up and Down adjust gain by 1 dB from -12 dB to +12 dB.
  • p and n restart the previous or next track.
  • a opens the file chooser; use Up/Down, Enter, Backspace, and Esc to browse.
  • Tab focuses playlist editing. Shift+Up/Down moves an unlocked entry, and Delete or d removes it.
  • q or Ctrl-C quits.

The playing row is locked while other entries can be reordered or removed. Tracks advance automatically. When the last track ends, the streamer returns to the lobby and keeps the Owncast connection and TUI alive; adding another video makes it available to start from the lobby.

The stereo VU meter shows the post-gain signal from -60 dB to 0 dB. Peak markers hold for 3 seconds, then decay at 12 dB per second.

When TITLE is omitted, the title comes from embedded media metadata, then a cleaned filename from torrent-name-parser, then the raw filename stem.

Test

cargo test
cargo clippy --all-targets -- -D warnings

About

Continuous lobby-to-movie streaming for Owncast

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages