donut

package module
v0.0.0-...-ca1a82e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2024 License: Apache-2.0 Imports: 23 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

donut is a zero setup required SRT+MPEG-TS -> WebRTC Bridge powered by Pion. This fork operates in 2 possible modes:

  1. as a viewer - providing a browser compatible endpoint for a single SRT stream. - useful for previews and testing.
  2. as a bridge - providing a protocol translator to WHIP - useful for feeding SRT into SFUs or broadcast fanout systems

Install & Run Locally

Make sure you have the libsrt installed in your system. If not, follow their build instructions. Once you finish installing it, execute:

$ go install github.com/flavioribeiro/donut@latest

Once installed, execute donut. This will be in your $GOPATH/bin. The default will be ~/go/bin/donut

Run without args it works in viewer mode and springs up a webserver With -whip-uri and -srt-uri set it acts as a WHIP forwarder

Install & Run using Docker

Alternatively, you can build a docker image. Docker will take care of downloading the dependencies (including the libsrt) and compiling donut for you.

$ docker build -t donut .
$ docker run -it -p 8080:8080 donut

Open the Web UI for viewer

Open http://localhost:8080. You will see three text boxes. Fill in your details for your SRT listener configuration and hit connect.

Acting as a WHIP forwarder

This example requires port 5000 UDP to be open for inbound traffic

$ donut ./donut -whip-uri https://galene.pi.pe/group/whip/ -srt-uri "srt://0.0.0.0:5000?streamid=test" \
    -whip-token ${bearertoken}

You can then send multiple SRT streams to be forwarded as WHIP examples: Camera from a mac:

ffmpeg -f avfoundation  -framerate 30 -i "0" \
   -pix_fmt yuv420p -c:v libx264 -b:v 1000k -g 30 -keyint_min 120 -profile:v baseline \
   -preset veryfast -f mpegts  "srt://${bridgeIP}:5000?streamid=me"

Or from a raspi

ffmpeg -f video4linux2 -input_format h264 -video_size 1280x720 -framerate 30 \
-i /dev/video0 -vcodec copy -an -f mpegts "srt://${bridgeIP}:5000?streamid=picam"


Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(params InitParams)

Types

type InitParams

type InitParams struct {
	OnBeforeAccept astisrt.ServerOnBeforeAccept
}

type SRTOffer

type SRTOffer struct {
	SRTHost     string
	SRTPort     string
	SRTStreamID string
	Offer       webrtc.SessionDescription
}

type WHIPClient

type WHIPClient struct {
	// contains filtered or unexported fields
}

func NewWHIPClient

func NewWHIPClient(endpoint string, token string) *WHIPClient

func (*WHIPClient) Close

func (whip *WHIPClient) Close(skipTlsAuth bool)

func (*WHIPClient) Publish

func (whip *WHIPClient) Publish(napi *webrtc.API, config webrtc.Configuration, sid string) *webrtc.TrackLocalStaticSample

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址