Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/nestrilabs/nestri/llms.txt

Use this file to discover all available pages before exploring further.

nestri-server builds its GStreamer encoding pipeline from the flags described on this page. Video and audio encoding are configured independently. The server selects the best available hardware encoder for the requested codec at startup; you can override the encoder name directly if you need to pin a specific GStreamer element.

Video encoding

Codec selection

--video-codec
string
default:"h264"
Preferred video codec. The server selects the highest-scoring encoder that supports this codec and successfully initialises.Accepted values: h264, h265, av1Environment variable: VIDEO_CODEC
ValueAliases acceptedNotes
h264h.264, avcDefault. Widest browser support. 8-bit colour only.
h265h.265, hevc, hev1Better compression; browser support varies.
av1Best efficiency; Chromium-based browsers.
--video-encoder
string
Override the automatic encoder selection with a specific GStreamer element name (e.g. vah264lpenc, nvh265enc, x264enc). The named element must exist in the GStreamer registry.Environment variable: VIDEO_ENCODER
--video-encoder-type
string
default:"hardware"
Constrain encoder selection to hardware or software. When set to hardware, only elements whose GStreamer klass metadata contains /hardware are considered.Environment variable: VIDEO_ENCODER_TYPE

Rate control

--video-rate-control
string
default:"cbr"
Rate control method for the video encoder.Accepted values: cbr, vbr, cqpEnvironment variable: VIDEO_RATE_CONTROL
Encoder targets exactly --video-bitrate kbps at all times. Produces predictable network utilisation and is the recommended mode for streaming.Uses --video-bitrate as the target; --video-bitrate-max is ignored.
Encoder targets --video-bitrate kbps but may burst up to --video-bitrate-max kbps on complex scenes. Typically produces better quality than CBR at the same average bitrate.
Encoder targets a fixed perceptual quality level defined by --video-cqp. Bitrate floats with scene complexity. Not bandwidth-bounded; use only on unconstrained networks.
--video-bitrate
number
default:"6000"
Target video bitrate in kbps. Used by CBR and VBR rate control.Environment variable: VIDEO_BITRATE
--video-bitrate-max
number
default:"8000"
Maximum video bitrate in kbps. Used only by VBR rate control.Environment variable: VIDEO_BITRATE_MAX
--video-cqp
number
default:"26"
Constant Quantization Parameter quality level. Lower values produce higher quality at higher bitrates. Valid range: 1–51. Used only by CQP rate control.Environment variable: VIDEO_CQP

Latency control

--video-latency-control
string
default:"lowest-latency"
Tuning preset applied on top of the selected rate control mode.Accepted values: lowest-latency, highest-qualityEnvironment variable: VIDEO_LATENCY_CONTROL
ValueDescription
lowest-latencySets encoder parameters that minimise encode-to-transmit delay. For NVENC: preset=p1, tune=ultra-low-latency, zerolatency=true. For QSV: low-latency=true, target-usage=7. For x264enc: speed-preset=ultrafast, tune=zerolatency.
highest-qualityAllows the encoder to use lookahead frames and multi-pass encoding for better visual quality at the cost of added latency. For NVENC: preset=p7, tune=high-quality, multi-pass=two-pass, spatial-aq=true, rc-lookahead=3.

Keyframe interval

--keyframe-dist-secs
number
default:"1"
Distance between keyframes (I-frames) in seconds. The actual GOP size sent to the encoder is framerate × keyframe-dist-secs. Shorter intervals improve seek and recovery behaviour but increase bitrate.Environment variable: KEYFRAME_DIST_SECS

Bit depth

--video-bit-depth
number
default:"8"
Video bit depth. Accepted values: 8, 10.Environment variable: VIDEO_BIT_DEPTH10-bit output requires all three of the following conditions to be true:
  • --zero-copy is enabled (DMA-BUF or CUDA memory path)
  • The video codec is not h264 (H.264 does not support 10-bit)
  • The selected encoder supports 10-bit output
When 10-bit is active the VA-API/QSV pipeline uses P010_10LE format instead of NV12.
H.264 does not support 10-bit colour. If you set --video-bit-depth 10 with --video-codec h264, the server will use 8-bit regardless.

Audio encoding

nestri-server currently supports Opus as the only audio codec. The opusenc GStreamer element is used by default, with a 10 ms frame size for low latency.

Audio capture

--audio-capture-method
string
default:"pipewire"
Audio capture backend. The selected value determines which GStreamer source element is used.Accepted values: pipewire, pulseaudio, alsaEnvironment variable: AUDIO_CAPTURE_METHOD
ValueGStreamer elementNotes
pipewirepipewiresrcDefault. Recommended with WirePlumber session manager.
pulseaudiopulsesrcUse when PipeWire is not available.
alsaalsasrcDirect ALSA access; no sound server required.

Codec and encoder

--audio-codec
string
default:"opus"
Preferred audio codec. Currently only opus is supported.Environment variable: AUDIO_CODEC
--audio-encoder
string
Override the audio encoder GStreamer element name. Defaults to opusenc. Use this if you need a custom or patched encoder element.Environment variable: AUDIO_ENCODER

Audio rate control and bitrate

--audio-rate-control
string
default:"cbr"
Rate control method for the audio encoder. Accepted values: cbr, vbr.Environment variable: AUDIO_RATE_CONTROL
CQP is not supported for audio. Setting cqp for audio rate control will cause the server to exit with an error.
--audio-bitrate
number
default:"128"
Target audio bitrate in kbps. Used by both CBR and VBR rate control.Environment variable: AUDIO_BITRATE
--audio-bitrate-max
number
default:"192"
Maximum audio bitrate in kbps. Used only by VBR rate control.Environment variable: AUDIO_BITRATE_MAX
--audio-latency-control
string
default:"lowest-latency"
Audio latency tuning preset. Accepted values: lowest-latency, highest-quality. The opusenc frame size is always set to 10 ms regardless of this setting.Environment variable: AUDIO_LATENCY_CONTROL

Common configurations

The default settings are optimised for interactive game streaming at 1080p/60 fps:
nestri-server \
  --relay-url wss://relay.example.com \
  --resolution 1920x1080 \
  --framerate 60 \
  --video-codec h264 \
  --video-rate-control cbr \
  --video-bitrate 6000 \
  --video-latency-control lowest-latency \
  --audio-capture-method pipewire \
  --audio-bitrate 128

Build docs developers (and LLMs) love