Documentation Index
Fetch the complete documentation index at: https://mintlify.com/bluenviron/gortsplib/llms.txt
Use this file to discover all available pages before exploring further.
gortsplib
gortsplib is a production-ready RTSP client and server library for Go, written to power MediaMTX. It implements RTSP 1.0 and 2.0, handles RTP/RTCP packet routing, and supports a wide array of codecs and transport modes.Quick Start
Get a working RTSP client or server running in minutes
Client Guide
Read and write RTSP streams with the Client API
Server Guide
Build custom RTSP servers with the handler interface
RTP Formats
Encode and decode H264, H265, AV1, AAC, Opus, and more
Key features
Client: Play & Record
Connect to any RTSP server to read media streams or publish your own, with automatic transport negotiation.
Server with handler interface
Implement only the callbacks you need —
OnDescribe, OnAnnounce, OnSetup, OnPlay, OnRecord — and gortsplib handles the protocol.Multiple transports
UDP, UDP-multicast, and TCP transports. The library switches automatically when a transport fails.
Secure variants
RTSPS (TLS), SRTP, and SRTCP for encrypted streams and authenticated sessions.
Tunneling
RTSP-over-HTTP and RTSP-over-WebSocket for traversing firewalls and proxies.
Rich codec support
Native RTP packetizers and depacketizers for H264, H265, AV1, VP8, VP9, AAC, Opus, G711, LPCM, and more.
Accurate timestamps
Extract PTS and NTP timestamps from inbound packets for synchronized playback or recording.
ONVIF back channels
Two-way audio support for ONVIF-compatible IP cameras using RTSP back channels.
Module path
gortsplib is published as a Go module. The current major version is v5:Go 1.25 or later is required.
Related projects
| Project | Description |
|---|---|
| MediaMTX | Production media server built on gortsplib |
| gohlslib | HLS client and server library for Go |
| gortmplib | RTMP client and server library for Go |
| mediacommon | Shared codec utilities |
| pion/rtp | RTP library used internally |
| pion/rtcp | RTCP library used internally |
| pion/srtp | SRTP library used internally |