MCPcopy Index your code
hub / github.com/bluenviron/gortsplib

github.com/bluenviron/gortsplib @v5.6.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v5.6.1 ↗ · + Follow
2,187 symbols 8,506 edges 349 files 1,014 documented · 46% 2 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

gortsplib

Test Lint Go Report Card CodeCov PkgGoDev

RTSP client and server library for the Go programming language, written for MediaMTX.

Go ≥ 1.25 is required.

Features:

  • Client
  • Support secure protocol variants (RTSPS, SRTP, SRTCP)
  • Support tunneling (RTSP-over-HTTP, RTSP-over-WebSocket)
  • Query servers about available media streams
  • Read media streams from a server ("play")
    • Read streams with the UDP, UDP-multicast or TCP transport protocol
    • Switch transport protocol automatically
    • Read selected media streams
    • Pause or seek without disconnecting from the server
    • Write to ONVIF back channels
    • Get PTS (presentation timestamp) of inbound packets
    • Get NTP (absolute timestamp) of inbound packets
  • Write media streams to a server ("record")
    • Write streams with the UDP or TCP transport protocol
    • Switch transport protocol automatically
    • Pause without disconnecting from the server
  • Server
  • Support secure protocol variants (RTSPS, SRTP, SRTCP)
  • Support tunneling (RTSP-over-HTTP, RTSP-over-WebSocket)
  • Handle requests from clients
  • Validate client credentials
  • Read media streams from clients ("record")
    • Read streams with the UDP or TCP transport protocol
    • Get PTS (presentation timestamp) of inbound packets
    • Get NTP (absolute timestamp) of inbound packets
  • Serve media streams to clients ("play")
    • Write streams with the UDP, UDP-multicast or TCP transport protocol
    • Compute and provide SSRC, RTP-Info to clients
    • Read ONVIF back channels
  • Utilities
  • Parse RTSP elements
  • Encode/decode RTP packets into/from codec-specific frames

Table of contents

Examples

API Documentation

Click to open the API Documentation

RTP Payload Formats

In RTSP, media streams are transmitted by using RTP packets, which are encoded in a specific, codec-dependent, format. This library supports the following formats:

Video

format documentation encoder and decoder available
AV1 link :heavy_check_mark:
VP9 link :heavy_check_mark:
VP8 link :heavy_check_mark:
H265 link :heavy_check_mark:
H264 link :heavy_check_mark:
MPEG-4 Video (H263, Xvid) link :heavy_check_mark:
MPEG-1/2 Video link :heavy_check_mark:
M-JPEG link :heavy_check_mark:

Audio

format documentation encoder and decoder available
Opus link :heavy_check_mark:
Vorbis link
MPEG-4 Audio (AAC) link :heavy_check_mark:
MPEG-4 Audio LATM (AAC-LATM) link :heavy_check_mark:
MPEG-1/2 Audio (MP3) link :heavy_check_mark:
AC-3 link :heavy_check_mark:
Speex link
G726 link
G722 link :heavy_check_mark:
G711 (PCMA, PCMU) link :heavy_check_mark:
LPCM link :heavy_check_mark:

Other

format documentation encoder and decoder available
MPEG-TS link :heavy_check_mark:
KLV link :heavy_check_mark:

Specifications

name area
RFC2326, RTSP 1.0 protocol
RFC7826, RTSP 2.0 protocol
ONVIF Streaming Specification 23.06 protocol
RFC8866, SDP: Session Description Protocol SDP
RFC4567, Key Management Extensions for Session Description Protocol (SDP) and Real Time Streaming Protocol (RTSP) secure variants
RFC3830, MIKEY: Multimedia Internet KEYing secure variants
RTP Payload Format For AV1 (v1.0) payload formats / AV1
RFC9628, RTP Payload Format for VP9 Video payload formats / VP9
RFC7741, RTP Payload Format for VP8 Video payload formats / VP8
RFC7798, RTP Payload Format for High Efficiency Video Coding (HEVC) payload formats / H265
RFC6184, RTP Payload Format for H.264 Video payload formats / H264
RFC3640, RTP Payload Format for Transport of MPEG-4 Elementary Streams payload formats / MPEG-4 audio, MPEG-4 video
RFC2250, RTP Payload Format for MPEG1/MPEG2 Video payload formats / MPEG-1/2 video, MPEG-1/2 audio, MPEG-TS
RFC2435, RTP Payload Format for JPEG-compressed Video payload formats / M-JPEG
RFC7587, RTP Payload Format for the Opus Speech and Audio Codec payload formats / Opus
Multiopus in libwebrtc payload formats / Opus
RFC5215, RTP Payload Format for Vorbis Encoded Audio payload formats / Vorbis
RFC4184, RTP Payload Format for AC-3 Audio payload formats / AC-3
RFC6416, RTP Payload Format for MPEG-4 Audio/Visual Streams payload formats / MPEG-4 audio LATM
RFC5574, RTP Payload Format for the Speex Codec payload formats / Speex
RFC3551, RTP Profile for Audio and Video Conferences with Minimal Control payload formats / G726, G722, G711, LPCM
RFC3190, RTP Payload Format for 12-bit DAT Audio and 20- and 24-bit Linear Sampled Audio payload formats / LPCM
RFC6597, RTP Payload Format for Society of Motion Picture and Television Engineers (SMPTE) ST 336 Encoded Data payload formats / KLV
Codec specifications codecs
Golang project layout project layout

Related projects

Extension points exported contracts — how you extend this code

ServerHandlerOnConnOpen (Interface)
ServerHandlerOnConnOpen can be implemented by a ServerHandler. [9 implementers]
server_handler.go
GlobalDecoderTrack (Interface)
GlobalDecoderTrack is a track (RTSP format or WebRTC track) of GlobalDecoder. [23 implementers]
pkg/rtptime/global_decoder.go
RangeValue (Interface)
RangeValue can be - RangeSMPTE - RangeNPT - RangeUTC [7 implementers]
pkg/headers/range.go
Format (Interface)
Format is a media format. It defines the payload type of RTP packets and how to encode/decode them. [22 implementers]
pkg/format/format.go
Payload (Interface)
Payload is a MIKEY payload. [4 implementers]
pkg/mikey/payload.go
PacketConn (Interface)
PacketConn is a packet connection. [2 implementers]
pkg/readbuffer/read_buffer.go
Conn (Interface)
Conn is a Multicast connection. [2 implementers]
pkg/multicast/conn.go
ClientOnRequestFunc (FuncType)
ClientOnRequestFunc is the prototype of Client.OnRequest.
client.go

Core symbols most depended-on inside this repo

Close
called by 334
server.go
ReadRequest
called by 205
pkg/conn/conn.go
WriteResponse
called by 203
pkg/conn/conn.go
ptrOf
called by 198
pkg/format/vp9.go
Close
called by 99
client.go
Marshal
called by 90
pkg/headers/range.go
ptrOf
called by 73
pkg/headers/rtp_info.go
ParseURL
called by 72
pkg/base/url.go

Shape

Method 1,096
Function 745
Struct 279
TypeAlias 33
Interface 24
FuncType 10

Languages

Go100%

Modules by API surface

client.go87 symbols
pkg/liberrors/client.go76 symbols
pkg/liberrors/server.go58 symbols
server_session.go52 symbols
server_handler.go50 symbols
server_test.go43 symbols
pkg/sdp/sdp.go34 symbols
server_play_test.go28 symbols
client_media.go28 symbols
server_session_media.go27 symbols
client_play_test.go27 symbols
server_conn.go24 symbols

Used by 2 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add gortsplib \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page