this repo has no description
at main 93 lines 2.7 kB view raw view rendered
1# browser-stream 2 3Stream a fullscreen website to RTMP/RTMPS using Chromium + FFmpeg. 4 5## Example usage 6 7```bash 8cargo run -- \ 9 --url https://example.com \ 10 --output rtmp://live.example.com/app/mystream 11``` 12 13Equivalent split URL + stream key: 14 15```bash 16cargo run -- \ 17 --url https://example.com \ 18 --rtmp-url rtmp://live.example.com/app \ 19 --stream-key mystream 20``` 21 22## Build and run locally 23 241. Fetch sidecars: 25 26```bash 27./scripts/fetch-sidecars.sh 28``` 29 302. Build: 31 32```bash 33cargo build --release 34``` 35 363. Run: 37 38```bash 39cargo run -- \ 40 --url https://example.com \ 41 --output rtmp://live.example.com/app/mystream 42``` 43 44## Docker 45 46Use environment variables (copy `.env.example` to `.env` and edit values), then run: 47 48```bash 49docker compose up --build 50``` 51 52Full image variant: 53 54```bash 55docker compose --profile full up --build browser-stream-full 56``` 57 58Build images directly: 59 60```bash 61docker build --target slim -t browser-stream:slim . 62docker build --target full -t browser-stream:full . 63``` 64 65## CLI arguments 66 67`browser-stream` supports the following flags: 68 69| Flag | Type | Default | Required | Notes | 70| --- | --- | --- | --- | --- | 71| `--url` | string | none | yes | Website URL. Must be `http` or `https`. | 72| `--width` | u32 | `1920` | no | Frame width. Min `16`. | 73| `--height` | u32 | `1080` | no | Frame height. Min `16`. | 74| `--fps` | u32 | `30` | no | Frame rate. Range `1..=120`. | 75| `--bitrate-kbps` | u32 | `4500` | no | Video bitrate in kbps. Min `100`. | 76| `--keyint-sec` | u32 | `1` | no | GOP/keyframe interval in seconds. Range `1..=60`. | 77| `--x264-opts` | string | `bframes=0` | no | Passed to x264 options. | 78| `--rtmp-url` | string | none | conditional | Use with `--stream-key` if `--output` is not set. | 79| `--stream-key` | string | none | conditional | Use with `--rtmp-url` if `--output` is not set. | 80| `--output` | string | none | conditional | Full output URL (for example `rtmp://.../app/key`). Alternative to `--rtmp-url` + `--stream-key`. | 81| `--retries` | u32 | `5` | no | Number of retry attempts after failure. | 82| `--retry-backoff-ms` | u64 | `1000` | no | Delay between retries (milliseconds). | 83| `--startup-delay-ms` | u64 | `2000` | no | Delay before starting frame capture (milliseconds). | 84| `--frame-timeout-ms` | u64 | `30000` | no | Frame read timeout (milliseconds). Min `1000`. | 85| `--no-audio` | bool flag | `false` | no | Disable silent audio track. | 86| `--ffmpeg-path` | path | auto | no | Override ffmpeg binary path. | 87| `--chromium-path` | path | auto | no | Override chromium/headless shell binary path. | 88| `--verbose` | bool flag | `false` | no | Enable verbose logging. | 89 90Output selection rules: 91 92- Provide `--output`, or 93- Provide both `--rtmp-url` and `--stream-key`.