Skip to content

donut is a zero setup required SRT+MPEG-TS -> WebRTC Bridge powered by Pion.

License

Notifications You must be signed in to change notification settings

flavioribeiro/donut

Repository files navigation

donut is a zero setup required SRT (MPEG-TS) and RTMP to WebRTC bridge powered by Pion.

HOW IT WORKS

sequenceDiagram
    actor User

    box Cornsilk
        participant browser
    end

    User->>+browser: input protocol, host, port, id, and opts
    User->>+browser: click on [Connect]
    
    Note over donut,browser: WebRTC connection setup
    
    browser->>+browser: create WebRTC browserOffer
    browser->>+donut: POST /doSignaling {browserOffer}

    donut->>+browser: reply WebRTC {serverOffer}

    Note over donut,browser: WebRTC connection setup

    loop Async streaming
        donut--)streaming server: fetchMedia
        donut--)donut: ffmpeg::libav demux/transcode
        donut--)browser: sendWebRTCMedia
        browser--)browser: render audio/video frames
        User--)browser: watch media
    end
Loading

donut docker-compose setup

ref: how donut works

QUICK START

Make sure you have the ffmpeg 5.x.x. You must configure the CGO library path pointing it to ffmpeg 5.

export CGO_LDFLAGS="-L/opt/homebrew/Cellar/ffmpeg@5/5.1.4_6/lib/"
export CGO_CFLAGS="-I/opt/homebrew/Cellar/ffmpeg@5/5.1.4_6/include/"
export PKG_CONFIG_PATH="/opt/homebrew/Cellar/ffmpeg@5/5.1.4_6/lib/pkgconfig"

Now you can install and run it:

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

Here are specific instructions to run on MacOS.

RUN USING DOCKER-COMPOSE

Alternatively, you can use docker-compose to simulate an SRT live transmission and run the donut effortless.

make run

OPEN THE WEB UI

Open http://localhost:8080/demo. You will see two text fields. Fill them with the your streaming info and hit connect.

donut docker-compose setup

FAQ

Please check the FAQ if you're facing any trouble.