Page.startScreencast, the same pipeline used for recording, so the stream survives page navigation. Each JPEG frame is piped to an ffmpeg process that encodes in real time and pushes to your destinations.PLAYWRITER_DIRECT), headless, and cloud browsers.ffmpeg installed and on PATHstate.page. Set it and navigate first, then start:playwriter -s 1 -e "state.page = await context.newPage(); await state.page.goto('https://my-generated-content.example')" playwriter stream start -s 1 --rtmp rtmp://va.pscp.tv:80/x/<stream-key>
--rtmp. It uses ffmpeg's tee muxer, so one encode serves all destinations, and 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>
# Uptime, frames sent and captured, audio chunks, encoder fps, bitrate, dropped frames playwriter stream status -s 1 # Graceful stop: flushes the encoder and waits for ffmpeg to exit playwriter stream stop -s 1 # => Stream stopped after 3600s (108000 frames)
| Flag | Default | Description |
--rtmp <url> | required | RTMP destination with stream key, repeatable |
--resolution <WxH> | 1920x1080 | Output resolution |
--fps <n> | 30 | Output frame rate |
--video-bitrate <kbps> | 9000 | X Live recommended; Twitch max is 6000 |
--keyframe-interval <s> | 3 | X Live recommended (and max); Twitch recommends 2 |
--audio-bitrate <kbps> | 128 | AAC 44100Hz stereo |
--no-audio | off | Skip page audio, sends a silent track (X Live requires an audio track) |
--preset <name> | veryfast | x264 preset, only applies to libx264 |
--codec <name> | auto | Auto-detects hardware encoders (videotoolbox, nvenc, qsv, amf), falls back to libx264 |
--video-bitrate 6000 --keyframe-interval 2.<audio>, <video> and AudioContexts playing to the speakers, then muxes the PCM in ffmpeg.--no-audio (or audio: false) a silent track is sent instead.execute code:await stream.start({ page: state.page, rtmpUrls: ['rtmp://va.pscp.tv:80/x/STREAM_KEY'], resolution: '1920x1080', fps: 30, videoBitrateKbps: 9000, }) // => { startedAt, destinations } await stream.status({ page: state.page }) // => { streaming, startedAt, destinations, stats: { videoFrames, capturedFrames, audioChunks, ffmpegFps, ffmpegBitrateKbps, droppedFrames }, error? } await stream.stop({ page: state.page }) // => { duration, frames }
page is optional for stop and status when only one stream is active. Stream keys are secrets: status output and logs only ever show redacted destinations (rtmp://host/…).--rtmp to send the same page to several platforms with one encode.recording.* | stream.* | |
| Output | video file on disk | RTMP endpoints |
| Duration | auto-stops after 15 min | runs until stopped, survives CLI exit |
| Audio | off by default | on by default |
| Encoding | ffmpeg, H.264 or VP8 | ffmpeg, H.264 with fixed keyframe interval |