Go to file
Alexandre Iooss dc01eca73c
Add ?nowidget GET parameter
2020-10-13 19:36:28 +02:00
auth Test bad username in basic auth backend 2020-10-09 23:19:53 +02:00
docs Change some configuration comments 2020-10-13 18:53:03 +02:00
internal Merge branch 'asciiart' into 'dev' 2020-10-13 18:48:00 +02:00
stream Add test file for telnet package 2020-10-13 18:55:12 +02:00
web Add ?nowidget GET parameter 2020-10-13 19:36:28 +02:00
.gitignore Use pkger to pack templates 2020-09-28 17:36:40 +02:00
.gitlab-ci.yml Upload HTML coverage as artifact 2020-10-09 22:55:32 +02:00
Dockerfile Order exposed ports 2020-10-13 18:01:20 +02:00
Dockerfile.bullseye 🎉 libsrt got packaged in community's Alpine Linux repo, FFMPEG is compiled with libsrt, so we use Alpine Linux 2020-10-01 09:29:25 +02:00
LICENSE License work under MIT 2020-09-25 15:26:33 +02:00
README.md Specify version for libsrt on Buster 2020-10-11 00:55:04 +02:00
go.mod Switch to configuro package 2020-10-12 21:23:06 +02:00
go.sum Switch to configuro package 2020-10-12 21:23:06 +02:00
main.go Sort imports 2020-10-13 18:04:00 +02:00
main_test.go Create config package and properly use Viper 2020-10-11 21:35:43 +02:00

README.md

Ghostream

License: MIT PkgGoDev Go Report Card pipeline status coverage report

Boooo! A simple streaming server with authentication and open-source technologies.

This project was developped at Cr@ns to stream events.

Features:

  • WebRTC playback with a lightweight web interface.
  • SRT stream input, supported by FFMpeg, OBS and Gstreamer.
  • Low-latency streaming, sub-second with web player.
  • Authentication of incoming stream using LDAP server.
  • Possibility to forward stream to other streaming servers.

Installation on Debian/Ubuntu

On Ubuntu 20.10+ or Debian 11+, you can install directly ghostream,

sudo apt install git golang ffmpeg libsrt1-openssl
go get gitlab.crans.org/nounous/ghostream

On Ubuntu 20.04 or Debian Buster, you may manually install libsrt 1.4.1: install libsrt1-openssl 1.4.1 then libsrt-openssl-dev 1.4.1.

For development, you may clone this repository, then go run main.go.

Installation with Docker

An example is given in docs/docker-compose.yml. It uses Traefik reverse proxy.

You can also launch the Docker image using,

docker build . -t ghostream
docker run -it --rm -p 2112:2112 -p 9710:9710/udp -p 8080:8080 -p 10000-10005:10000-10005/udp ghostream

Configuration

Ghostream can be configured by placing ghostream.yml in current directory, in ~/.ghostream/ or in /etc/ghostream/. You can also override any value using environnement variables, e.g. GHOSTREAM_AUTH_BACKEND=ldap will change the authentification backend.

Streaming

As stated by OBS wiki, when streaming you should adapt the latency to 2.5 * (the round-trip time with server, in μs).

With OBS

As OBS uses FFMpeg, you need to have FFMpeg compiled with SRT support. To check if SR is available, run ffmpeg -protocols | grep srt. On Windows and MacOS, OBS comes with his own FFMpeg that will work.

In OBS, go to "Settings" -> "Output" -> "Recording" the select "Output to URL" and change the URL to srt://127.0.0.1:9710?streamid=demo:demo. For container, you may use MPEGTS for now (will change).

With GStreamer

To stream X11 screen,

gst-launch-1.0 ximagesrc startx=0 show-pointer=true use-damage=0 \
! videoconvert \
! x264enc bitrate=32000 tune=zerolatency speed-preset=veryfast byte-stream=true threads=1 key-int-max=15 intra-refresh=true ! video/x-h264, profile=baseline, framerate=30/1 \
! mpegtsmux \
! srtserversink uri=srt://127.0.0.1:9710/ latency=1000000 streamid=demo:demo

Playing stream

With a web browser and WebRTC

Ghostream expose a web server on 0.0.0.0:8080 by default. By opening this in a browser, you will be able to get instructions on how to stream, and if you append /streamname to the URL, then you will be able to watch the stream named streamname.

The web player also integrates a side widget that is configurable.

With ffplay

You may directly open the SRT stream with ffplay:

ffplay -fflags nobuffer srt://127.0.0.1:9710?streamid=demo

With MPV

As MPV uses ffmpeg libav, support for SRT streams can be easily added. See current pull request.

Troubleshooting

ld returns an error when launching ghostream

When using libsrt-gnutls-dev rather than libsrt-openssl-dev on Debian/Ubuntu, then srtgo package is unable to build.

~/ghostream$ go run main.go
# github.com/haivision/srtgo
/usr/bin/ld: cannot find -lsrt
/usr/bin/ld: cannot find -lsrt
/usr/bin/ld: cannot find -lsrt
collect2: error: ld returned 1 exit status

The solution is to switch to libsrt-openssl-dev.

References