12. Quality Optimization
This page explains which settings control the quality each service receives, and how to choose them for your content.
12.1 Where Quality Is Set
- YouTube, Twitch partner mode (
TWITCH_PARTNER=TRUE) and Archive receive your streaming software's output unchanged. Set resolution, frame rate and bitrate in your streaming software. No relay variable changes them. - Twitch non-partner mode (the default) re-encodes the stream. Four variables set its output:
TWITCH_HEIGHT,TWITCH_FPS,TWITCH_KBITS_PER_VIDEO_FRAMEandTWITCH_X264_PRESET.
The rest of this page covers Twitch non-partner mode.
12.2 How the Twitch Settings Interact
The video bitrate is:
The encoder holds this rate constant. From that:
TWITCH_HEIGHTdoes not change the bitrate. A higher resolution spreads the same bits over more pixels, so each frame gets less detail per pixel.TWITCH_FPSchanges the bitrate. Halving it with the sameTWITCH_KBITS_PER_VIDEO_FRAMEhalves the bitrate.- The relay scales to
TWITCH_HEIGHTwhatever your source is. With a 720p source,TWITCH_HEIGHT=1080upscales, which adds no detail. TWITCH_X264_PRESETchanges CPU use and how efficiently the bitrate is used, not the bitrate. See Encoder Presets.
12.3 Content-Specific Settings
12.3.1 Fast Motion
Examples: first-person shooters, racing games, fast-paced action, streaming from a phone or camera on the move
Keep the frame rate high and accept a lower resolution. The defaults do this: TWITCH_HEIGHT=720, TWITCH_FPS=60, TWITCH_KBITS_PER_VIDEO_FRAME=75, for 4500 kbps.
12.3.2 Fine Detail, Little Motion
Examples: strategy games, puzzle games, art streams, slow-paced content
Raise the resolution and lower the frame rate. Raise TWITCH_KBITS_PER_VIDEO_FRAME at the same time, or the bitrate falls:
TWITCH_HEIGHT |
TWITCH_FPS |
TWITCH_KBITS_PER_VIDEO_FRAME |
Video bitrate |
|---|---|---|---|
| 720 | 60 | 75 (defaults) | 4500 kbps |
| 1080 | 30 | 75 | 2250 kbps: half the default bitrate for 2.25 times the pixels per frame |
| 1080 | 30 | 100 | 3000 kbps |
| 1080 | 30 | 150 | 4500 kbps: the same bitrate as the defaults |
Before raising the bitrate above the default, check Twitch's limits in its Broadcasting Guidelines. For more combinations, see the Bitrate Reference Table.
12.4 Balancing Quality and Resources
- Upload-constrained: lower
TWITCH_KBITS_PER_VIDEO_FRAMEorTWITCH_FPS. LoweringTWITCH_HEIGHTalone does not reduce upload. See Bandwidth Requirements. - CPU-constrained: use a faster
TWITCH_X264_PRESET, or lowerTWITCH_HEIGHTorTWITCH_FPS. See CPU Considerations.
12.5 See Also
- Bandwidth Requirements - Upload and disk space
- CPU Considerations - CPU cost of Twitch re-encoding
- Stream to Twitch - Twitch settings and bitrate reference table
- Services Overview - Service pattern comparison