Agent-readable docs index: /llms.txt. Full docs in one file: /llms-full.txt. Download /docs.zip to grep all markdown files locally.

Live Stream a Browser Tab to RTMP

Stream a tab live to RTMP endpoints like X Live, Twitch, or YouTube. Playwriter captures the tab with the same chrome.tabCapture pipeline used for recording, so the stream survives page navigation. The relay pipes each capture chunk to an ffmpeg process that re-encodes in real time and pushes to your destinations.
ffmpeg runs inside the relay process, so the stream keeps running after the CLI exits. Perfect for 24/7 auto-generated content: render a web page, stream it forever.

Requirements

  • ffmpeg installed and on PATH
  • Extension capture permission: use playwriter browser start for automated flows, or click the Playwriter extension icon on the tab once
  • Not available in headless or direct CDP mode (relies on the extension's chrome.tabCapture)

Limitations

  • Manual permission click per tab. Chrome's activeTab model requires a user gesture: you must click the Playwriter extension icon on the tab before it can be captured, and the grant is per tab — streaming a different tab needs another click on that tab. This is a Chrome platform restriction, not a Playwriter one. For fully automated flows, launch a managed browser with playwriter browser start, which auto-accepts tab capture without any click.
  • One stream per tab. A tab can have only one active capture: it can be streamed or recorded, not both, and not streamed twice.
  • Multiple tabs at once is untested. The architecture supports one stream per tab (each with its own ffmpeg process), but Chrome does not officially document support for many simultaneous tabCapture streams, and each stream costs a full real-time encode. Test with your setup before relying on it for production multi-streaming; prefer the tee muxer (repeat --rtmp) when you want the same tab on several platforms — that's one capture and one encode.
  • A few seconds of latency (capture chunking + encoder buffering) — fine for live streaming, not for real-time interaction.

Start streaming

The stream captures the session's current page — navigate first, then start:
playwriter -s 1 -e "await page.goto('https://my-generated-content.example')" playwriter stream start -s 1 --rtmp rtmp://va.pscp.tv:80/x/<stream-key>
Simultaneous multi-streaming — repeat --rtmp (uses ffmpeg's tee muxer, one encode for all destinations; a dead endpoint doesn't kill the others):
playwriter stream start -s 1 \ --rtmp rtmp://va.pscp.tv:80/x/<x-stream-key> \ --rtmp rtmp://live.twitch.tv/app/<twitch-stream-key>

Monitor and stop

# Uptime, encoder fps, output bitrate, dropped frames playwriter stream status -s 1 # Graceful stop: flushes the encoder and waits for ffmpeg to exit playwriter stream stop -s 1

Options

FlagDefaultDescription
--rtmp <url>requiredRTMP destination with stream key, repeatable
--resolution <WxH>1920x1080Output resolution, ffmpeg scales the capture
--fps <n>30Output frame rate
--video-bitrate <kbps>9000X Live recommended; Twitch max is 6000
--keyframe-interval <s>3X Live recommended (and max); Twitch recommends 2
--audio-bitrate <kbps>128AAC 44100Hz stereo
--no-audiooffSkip tab audio, injects a silent track (X Live requires an audio track)
--preset <name>veryfastx264 preset, only applies to libx264
--codec <name>autoAuto-detects hardware encoders (videotoolbox, nvenc, qsv), falls back to libx264
Defaults match X Live's recommended encoder settings (1080p, 9000 kbps H.264, 30 fps, 3s keyframes, AAC 128k 44100Hz stereo). For Twitch use --video-bitrate 6000 --keyframe-interval 2.

Executor API

The same functionality is available inside execute code:
await stream.start({ rtmpUrls: ['rtmp://va.pscp.tv:80/x/STREAM_KEY'], resolution: '1920x1080', fps: 30, videoBitrateKbps: 9000, }) await stream.status() // => { streaming, startedAt, destinations, stats: { ffmpegFps, ffmpegBitrateKbps, droppedFrames, ... } } await stream.stop() // => { duration, bytesReceived }
Stream keys are secrets: status output and logs only ever show redacted destinations (rtmp://host/…).

Latency

The extension emits capture chunks every second, and the encoder adds a little buffering: expect roughly 2 to 4 seconds of glass-to-glass latency before the platform's own delay. Fine for live streams, not designed for real-time interaction.

Streaming vs recording

recording.*stream.*
OutputMP4 file on diskRTMP endpoints
Durationauto-stops after 15 minunlimited, runs after CLI exits
Encodingin-browser MediaRecorderffmpeg re-encode (CBR, fixed GOP)
Same tab at onceone capture per tab — a tab can be recorded or streamed, not both