Skip to content

@seydx/rtsp / RtspServerSinkOptions

Interface: RtspServerSinkOptions

Defined in: sinks/rtsp-server/rtsp-server-sink.ts:24

Configuration for an RtspServerSink.

Controls the address the server binds to, the path viewers connect on, the RTP packetization size, optional authentication, and whether a talkback (ONVIF backchannel) media is advertised to clients. Every field is optional; sensible defaults are applied for a localhost-only server.

Properties

audioTranscode?

optional audioTranscode?: AudioTranscodeTarget

Defined in: sinks/rtsp-server/rtsp-server-sink.ts:102

Normalize incoming audio by decoding and re-encoding it, instead of the default bitstream-filter passthrough.

Some upstreams deliver unreliable or incompatible elementary audio (for example raw ADTS AAC whose header layout a passthrough bitstream filter cannot adapt), which otherwise fails the whole delivery channel. When set, every audio track is routed through a decode → resample → re-encode pipeline and the re-encoded packets are muxed, producing standards-compliant parameters the RTP muxer always accepts. Video and data tracks are never affected; omitted target fields preserve the decoded source's values.


auth?

optional auth?: RtspAuth

Defined in: sinks/rtsp-server/rtsp-server-sink.ts:65

Authenticator that pulling clients must satisfy before they can DESCRIBE or play the stream.

When provided, every request is challenged (Basic or Digest); when omitted the endpoint is open to any client that can reach it.

See

RtspAuth


backchannel?

optional backchannel?: boolean | BackchannelAdvertise

Defined in: sinks/rtsp-server/rtsp-server-sink.ts:88

Advertise a talkback (ONVIF backchannel) media section to viewers so they can send audio back to the camera.

Pass true to advertise the upstream's own backchannel codec verbatim, so inbound viewer RTP is forwarded straight through (pass-through). Pass a BackchannelAdvertise to advertise a specific codec instead, in which case the relay transcodes the viewer audio into the camera's native format. When the upstream advertises no backchannel, the request is ignored with a warning.


detachDelay?

optional detachDelay?: number

Defined in: sinks/rtsp-server/rtsp-server-sink.ts:139

How long, in milliseconds, to stay attached to the relay after the last client disconnects.

Detaching tears down the per-track muxers and the resolved SDP, so an immediate detach forces the next viewer through a full warm-up (muxer headers, keyframe sync, SDP generation) even when it reconnects right away — the typical pattern of pulling clients that retry on a read timeout (for example ffmpeg with -timeout, or a restreamer that reconnects). The grace period keeps that state warm across the gap: a viewer arriving within the window is answered from the existing SDP immediately, and the upstream never observes the detach. The relay's own idleTimeout only starts counting once the sink actually detaches. Set to 0 to detach as soon as the last client leaves.

Default

ts
5000

host?

optional host?: string

Defined in: sinks/rtsp-server/rtsp-server-sink.ts:33

Hostname or IP address the TCP listener binds to.

Use a specific interface address to limit reachability, or 0.0.0.0 to accept connections on every interface.

Default

ts
'127.0.0.1'

logger?

optional logger?: Logger

Defined in: sinks/rtsp-server/rtsp-server-sink.ts:147

Logger used to emit diagnostics about the server lifecycle and per-request activity.

When omitted no diagnostics are emitted.


mtu?

optional mtu?: number

Defined in: sinks/rtsp-server/rtsp-server-sink.ts:75

Maximum RTP packet size in bytes used by the underlying muxer.

Larger payloads are fragmented to fit within this limit. The default keeps packets comfortably below typical network MTUs to avoid IP fragmentation.

Default

ts
1200

path?

optional path?: string

Defined in: sinks/rtsp-server/rtsp-server-sink.ts:54

Stream path that viewers append to the server URL (the portion after the port, e.g. rtsp://host:port/live).

Any leading slashes are stripped, so live and /live are equivalent.

Default

ts
'live'

port?

optional port?: number

Defined in: sinks/rtsp-server/rtsp-server-sink.ts:44

TCP port the RTSP server listens on.

When omitted (or 0), the operating system assigns a free ephemeral port; the chosen value is reflected by RtspServerSink.url after RtspServerSink.listen resolves.

Default

ts
an ephemeral free port

sdpTimeout?

optional sdpTimeout?: number

Defined in: sinks/rtsp-server/rtsp-server-sink.ts:120

How long, in milliseconds, to wait for every track to produce its RTP header before generating the DESCRIBE SDP without the stalled tracks.

The SDP can only describe tracks whose muxer has emitted a header, which happens on a track's first successfully muxed packet. A track that never produces one (for example a permanently undecodable audio stream routed through RtspServerSinkOptions.audioTranscode) would otherwise stall SDP generation and hang every DESCRIBE. When the deadline — measured from sink initialization — passes, stalled tracks are excluded from the SDP and the remaining tracks are served; if no track produced a header at all, pending DESCRIBEs fail with 503 Service Unavailable instead of hanging. Set to 0 to disable and wait indefinitely.

Default

ts
10000