Skip to content

mitchcl/ffmpeg_teb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Twitch Enhanced Broadcasting (TEB) Streamer

Streams a local file or live source to Twitch using Enhanced Broadcasting (multitrack / adaptive bitrate) via a single RTMP connection and FFmpeg.


Requirements


Setup

1. Install Python dependency

py -m pip install requests

If py is not found, install Python from https://www.python.org/downloads/ and ensure "Add Python to PATH" is checked.

2. Install FFmpeg

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

Usage

Stream a local file

py teb_stream.py --key live_XXXX_YYYY --input "C:\path\to\video.mp4"

Stream a live source (e.g. OBS virtual camera, capture card)

py teb_stream.py --key live_XXXX_YYYY --input rtmp://localhost/live/stream

Preview the FFmpeg command without streaming

py teb_stream.py --key live_XXXX_YYYY --input "video.mp4" --dry-run

Debug the Twitch API response

py teb_stream.py --key live_XXXX_YYYY --input "video.mp4" --debug

How it works

  1. Calls the Twitch TEB API to fetch your personalised encoder configuration (resolutions, bitrates, frame rates).
  2. 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.
  3. 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.


Troubleshooting

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+

About

Streams a local file or live source to Twitch using Enhanced Broadcasting (multitrack / adaptive bitrate) via a single RTMP connection and FFmpeg.

Resources

Stars

Watchers

Forks

Contributors

Languages