MCPcopy Create free account
hub / github.com/Glimesh/broadcast-box

github.com/Glimesh/broadcast-box

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.1.1 ↗ · + Follow · compare 2 versions
496 symbols 1,323 edges 131 files 51 documented · 10% ● updated 51d agov2.0.2 · 2026-02-21★ 2,31712 open issues

Browse by type

⨍ Functions 380◇ Types & classes 116
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Broadcast Box

[![License][license-image]][license-url] [![Discord][discord-image]][discord-invite-url]

What is Broadcast Box

Broadcast Box lets you broadcast/screen-share to friends in sub-second time. It was designed to be simple to use and easily modifiable. Broadcast Box uses WebRTC, to learn more see the OBS WHIP Streaming Guide

Want to contribute to the development of Broadcast Box? See Contributing.

Using

A public instance of Broadcast Box is hosted at b.siobud.com. Feel free to use this as much as you want. Go to Getting Started for instructions on running it locally.

OBS Broadcasting

To use Broadcast Box with OBS you must set your output to WebRTC and set a proper URL + Stream Key. You may use any Stream Key you like. The same stream key is used for broadcasting and playback.

Go to Settings -> Stream and set the following values.

Your settings page should look like this:

OBS Stream settings example

OBS by default will have ~2 seconds of latency. If you want sub-second latency you can configure this in Settings -> Output. Set your encoder to x264 and set tune to zerolatency. Your Output page will look like this.

OBS Output settings example

When you are ready to broadcast press Start Streaming and now time to watch!

Browser Publishing

Open /publish/<streamKey> (for example https://b.siobud.com/publish/StreamTest) to publish directly from the browser. Broadcast Box can capture either your screen or webcam and uses the same stream key for playback.

If the supplied bearer token belongs to a reserved profile, the page also exposes profile settings so you can update the stream MOTD and toggle public/private visibility without leaving the publish flow.

FFmpeg Broadcasting

The following simple example broadcasts video-test.mp4 to https://b.siobud.com with a Bearer Token of ffmpeg-test

ffmpeg -re -i video-test.mp4 -bf 0 -f whip -authorization ffmpeg-test https://b.siobud.com/api/whip

For now, FFmpeg WHIP only supports H.264 (libx264) and Opus and will use them by default if the -vcodec and -acodec options are omitted. However, you can use any H.264 encoder, such as:

ffmpeg -hwaccel vulkan -re -i video-test.mp4 -bf 0 -vcodec h264_vaapi \
  -vf 'format=nv12|vulkan,hwupload' -init_hw_device vulkan \
  -f whip -authorization ffmpeg-test https://b.siobud.com/api/whip

The following complex example broadcasts a test feed to https://b.siobud.com with a Bearer Token of ffmpeg-test

ffmpeg \
  -re \
  -f lavfi -i testsrc=size=1280x720 \
  -f lavfi -i sine=frequency=440 \
  -pix_fmt yuv420p -vcodec libx264 -profile:v baseline -r 25 -g 50 \
  -acodec libopus -ar 48000 -ac 2 \
  -f whip -authorization "ffmpeg-test" \
  "https://b.siobud.com/api/whip"

Note that WHIP support and libx264 are required for this example. WHIP was added in version 8 of FFmpeg.

GStreamer Broadcasting

See the example script here.

Can broadcast gstreamer's test sources, or pulsesrc+v4l2src

Expects gstreamer-1.0, with good,bad,ugly plugins and gst-plugins-rs

Use of example scripts:

# testsrcs
./examples/gstreamer-broadcast.sh http://localhost:8080/api/whip testStream1
# v4l2src
./examples/gstreamer-broadcast.sh http://localhost:8080/api/whip testStream1 v4l2

Playback

If you are broadcasting to the Stream Key StreamTest your video will be available at https://b.siobud.com/StreamTest.

The player page also supports multi-view playback. Use the Add Stream button in the footer to add more active streams to the same page, and use ?cinemaMode=true to open the player in a chrome-free layout.

You can also go to the home page and enter StreamTest. The following is a screenshot of OBS broadcasting and the latency of 120 milliseconds observed.

Example have potential latency

Admin Portal

When FRONTEND_ADMIN_TOKEN is set Broadcast Box provides an Admin Portal at /admin. The same token is used to log in.

The current Admin Portal exposes:

  • Status to inspect active publishers/subscribers and metadata
  • Profiles to create stream profiles, rotate tokens, and remove profiles
  • Logging to read the current server log file

Stream Profiles let you reserve a stream key, so only authorized users can stream to that key.

Admin Portal

Statistics

Viewable at /statistics, this page shows stream uptime, track metrics, and WHEP session details.

This page relies on /api/status, so disabling the status API disables statistics.

Statistics

Examples

The repository includes a few small examples and integration helpers:

Getting Started

Broadcast Box is made up of two parts. The server is written in Go and is in charge of ingesting and broadcasting WebRTC. The frontend is in react and connects to the Go backend. The Go server can be used to serve the HTML/CSS/JS directly. Use the following instructions to build from source or utilize Docker / Docker Compose.

Configuring

The backend loads .env.production by default. Set APP_ENV=development to load .env.development instead.

If you only want the backend API or CLI helpers without serving the built frontend, set DISABLE_FRONTEND=TRUE.

Building From Source

Frontend

React dependencies are installed by running npm install in the web directory.

  • npm run build builds production assets into web/build
  • npm start runs the Vite dev server and proxies /api to the backend
  • npm run host runs the same Vite dev server on your local network

If everything is successful, you should see output similar to:

> broadcast-box@0.1.0 build
> vite build

[dotenv@17.2.3] injecting env (0) from ../.env.development,../.env -- tip: ⚙️  load multiple .env files with { path: ['.env.local', '.env'] }
Target Backend: http://localhost:8080
vite v6.4.1 building for production...
✓ 724 modules transformed.
build/index.html                       0.84 kB │ gzip:  0.49 kB
build/assets/index-BZVYZNKC.css       20.37 kB │ gzip:  4.82 kB
build/assets/index-BeQC1JnS.js         1.43 kB │ gzip:  0.69 kB
build/assets/components-BcOZaJ_1.js   63.11 kB │ gzip: 16.08 kB
build/assets/node-DpLsG32O.js        239.39 kB │ gzip: 75.76 kB
✓ built in 601ms

Backend

Go dependencies are automatically installed.

To run the Go server, run go run . in the root of this project, you should see the following:

2026/02/24 12:00:00 Environment: Loading `.env.production`
2026/02/24 12:00:00 Starting HTTP server at :8080

To use Broadcast Box navigate to: http://<YOUR_IP>:8080. In your broadcast tool of choice, you will broadcast to http://<YOUR_IP>:8080/api/whip.

Docker

A Docker image is also provided to make it easier to run locally and in production. The arguments you run the Dockerfile with depending on if you are using it locally or a server.

If you want to run locally execute docker run -e UDP_MUX_PORT=8080 -e NAT_1_TO_1_IP=127.0.0.1 -p 8080:8080 -p 8080:8080/udp seaduboi/broadcast-box. This will make broadcast-box available on http://localhost:8080. The UDPMux is needed because Docker on macOS/Windows runs inside a NAT.

If you are running on AWS (or other cloud providers) execute. docker run --net=host -e INCLUDE_PUBLIC_IP_IN_NAT_1_TO_1_IP=yes seaduboi/broadcast-box broadcast-box needs to be run in net=host mode. broadcast-box listens on random UDP ports to establish sessions.

Docker Compose

A Docker Compose is included that uses LetsEncrypt for automated HTTPS. It also includes Watchtower so your instance of Broadcast Box will be automatically updated every night. If you are running on a VPS/Cloud server this is the quickest/easiest way to get started.

export URL=my-server.com
docker-compose up -d

Reverse proxies

When serving the page over a reverse proxy, you must ensure that http://<YOUR_IP>/api/sse is unbuffered as it can otherwise cause a delay in receiving events until the buffer is flushed and cause issues with the video controls.

For example in nginx you would use the following configuration

    location /api/sse {
        proxy_pass http://<YOUR_IP>:<PORT>;
        # ... other configurations
        proxy_buffering off;
    }

URL Parameters

The frontend can be configured by passing these URL Parameters.

  • cinemaMode=true - Forces the player into cinema mode by adding to end of URL like https://b.siobud.com/myStream?cinemaMode=true

Environment Variables

Server Configuration

Variable Description
APP_ENV Set to development to load .env.development instead of .env.production.
HTTP_ADDRESS Address for the main server to bind to. Used for HTTP, or HTTPS when certificates are configured.
ENABLE_HTTP_REDIRECT When set, enables automatic redirection from HTTP to HTTPS.
HTTPS_REDIRECT_PORT Port to listen on for the HTTP-to-HTTPS redirect server.
NETWORK_TEST_ON_START If true, checks network connectivity on startup.
DISABLE_STATUS When set, disables /api/status. Stream discovery and /statistics rely on this endpoint.
ENABLE_PROFILING If true, enables PPROF profiling on localhost:6060.

SSL Configuration

Variable Description
SSL_CERT Path to the SSL certificate file. When set together with SSL_KEY, the Go server serves HTTPS.
SSL_KEY Path to the SSL key file. When set together with SSL_CERT, the Go server serves HTTPS.

Authorization & Profiles

Variable Description
STREAM_PROFILE_PATH Path to store stream profile configurations. Default is profiles.
STREAM_PROFILE_POLICY Policy configuration for local reserved profiles. Default is ANYONE_WITH_RESERVED. See Stream Profile Policy.
WEBHOOK_URL URL for a webhook backend used to authorize/log publish (WHIP) and subscribe (WHEP) requests. See Webhooks.

Frontend Configuration

Variable Description
DISABLE_FRONTEND Disables frontend asset serving and UI routes (/, /publish, /statistics, /admin).
FRONTEND_PATH Path to built frontend assets. Defaults to ./web/build.
FRONTEND_ADMIN_TOKEN Enables /admin and defines the bearer token required to log in.

WebRTC & Networking

| Variable | Description | | ------------

Extension points exported contracts — how you extend this code

browse all types & interfaces →

Core symbols most depended-on inside this repo

browse all functions →

Shape

Function 240
Method 140
Interface 59
Struct 48
Class 4
Enum 3
TypeAlias 2

Languages

Go61%
TypeScript39%

Modules by API surface

internal/chat/chat.go25 symbols
web/src/components/player/Player.tsx21 symbols
internal/webrtc/sessions/session/session.go15 symbols
internal/chat/store_in_memory.go15 symbols
web/src/components/player/functions/peerconnection.tsx14 symbols
web/src/components/player/functions/chatDataChannel.ts14 symbols
web/src/providers/StatusProvider.tsx12 symbols
web/src/components/player/components/ChatPanel.tsx11 symbols
internal/webrtc/sessions/whep/whep.go10 symbols
internal/webrtc/sessions/whep/packet_writer_test.go10 symbols
internal/webrtc/sessions/session/datachannels.go10 symbols
internal/webrtc/sessions/manager/manager.go10 symbols

Dependencies from manifests, versioned

github.com/pion/datachannelv1.6.3 · 1×
github.com/pion/interceptorv0.1.51 · 1×
github.com/pion/loggingv0.2.4 · 1×
github.com/pion/mdns/v2v2.2.2 · 1×
github.com/pion/randutilv0.1.0 · 1×
github.com/pion/rtcpv1.2.20 · 1×
github.com/pion/rtpv1.10.6 · 1×
github.com/pion/sctpv1.12.0 · 1×

For agents

$ claude mcp add broadcast-box \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page