Streams a local file or live source to Twitch using Enhanced Broadcasting (multitrack / adaptive bitrate) via a single RTMP connection and FFmpeg.
- Windows (tested), Linux/macOS (untested)
- Python 3.x — use the Python Launcher (
py) ifpythonis not on your PATH - FFmpeg 8.0+ on your PATH
- A Twitch account with Enhanced Broadcasting enabled at https://dashboard.twitch.tv/stream-manager
py -m pip install requests
If
pyis not found, install Python from https://www.python.org/downloads/ and ensure "Add Python to PATH" is checked.
Install FFmpeg 8.0+ and ensure ffmpeg is on your PATH.
On Windows, winget is the easiest option:
winget install Gyan.FFmpeg
Verify it works:
ffmpeg -version
py teb_stream.py --key live_XXXX_YYYY --input "C:\path\to\video.mp4"
py teb_stream.py --key live_XXXX_YYYY --input rtmp://localhost/live/stream
py teb_stream.py --key live_XXXX_YYYY --input "video.mp4" --dry-run
py teb_stream.py --key live_XXXX_YYYY --input "video.mp4" --debug
- Calls the Twitch TEB API to fetch your personalised encoder configuration (resolutions, bitrates, frame rates).
- Builds an FFmpeg filter graph that splits the input into N video tracks (up to 5), scales/fps-converts each one, and encodes them all with libx264.
- Muxes all tracks into a single enhanced FLV stream and pushes it to the Twitch ingest over RTMP.
Twitch then distributes the appropriate quality to each viewer automatically.
| Symptom | Cause | Fix |
|---|---|---|
Fatal error in launcher running pip |
Python 3.12 install is broken | Use py -m pip instead |
ffmpeg not found |
FFmpeg not installed or not on PATH | Install FFmpeg 8.0+ and add to PATH |
| TEB API error | Enhanced Broadcasting not enabled | Enable at twitch.tv/stream-manager |
invalid number of streams |
FFmpeg version too old (pre-8.0) | Upgrade to FFmpeg 8.0+ |