Awesome
gortsplib
RTSP 1.0 client and server library for the Go programming language, written for MediaMTX.
Go ≥ 1.21 is required.
Features:
- Client
- Query servers about available media streams
- Play (read)
- Read media streams from servers with the UDP, UDP-multicast or TCP transport protocol
- Read TLS-encrypted streams (TCP only)
- Switch transport protocol automatically
- Read selected media streams
- Pause or seek without disconnecting from the server
- Write to ONVIF back channels
- Get PTS (relative) timestamp of incoming packets
- Get NTP (absolute) timestamp of incoming packets
- Record (write)
- Write media streams to servers with the UDP or TCP transport protocol
- Write TLS-encrypted streams (TCP only)
- Switch transport protocol automatically
- Pause without disconnecting from the server
- Server
- Handle requests from clients
- Record (read)
- Read media streams from clients with the UDP or TCP transport protocol
- Read TLS-encrypted streams (TCP only)
- Get PTS (relative) timestamp of incoming packets
- Get NTP (absolute) timestamp of incoming packets
- Play (write)
- Write media streams to clients with the UDP, UDP-multicast or TCP transport protocol
- Write TLS-encrypted streams (TCP only)
- Compute and provide SSRC, RTP-Info to clients
- Utilities
- Parse RTSP elements
- Encode/decode RTP packets into/from codec-specific frames
Table of contents
Examples
- client-query
- client-play
- client-play-timestamp
- client-play-options
- client-play-pause
- client-play-to-record
- client-play-backchannel
- client-play-format-av1
- client-play-format-g711
- client-play-format-g722
- client-play-format-h264
- client-play-format-h264-convert-to-jpeg
- client-play-format-h264-save-to-disk
- client-play-format-h264-mpeg4audio-save-to-disk
- client-play-format-h265
- client-play-format-h265-convert-to-jpeg
- client-play-format-h265-save-to-disk
- client-play-format-lpcm
- client-play-format-mjpeg
- client-play-format-mpeg4audio
- client-play-format-mpeg4audio-save-to-disk
- client-play-format-opus
- client-play-format-opus-save-to-disk
- client-play-format-vp8
- client-play-format-vp9
- client-record-options
- client-record-pause
- client-record-format-g711
- client-record-format-g722
- client-record-format-h264
- client-record-format-h264-from-disk
- client-record-format-h265
- client-record-format-lpcm
- client-record-format-mjpeg
- client-record-format-mjpeg-from-image
- client-record-format-mpeg4audio
- client-record-format-opus
- client-record-format-vp8
- client-record-format-vp9
- server
- server-tls
- server-h264-save-to-disk
- proxy
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 formats for the following codecs:
Video
codec | 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
codec | documentation | encoder and decoder available |
---|---|---|
Opus | link | :heavy_check_mark: |
Vorbis | link | |
MPEG-4 Audio (AAC) | 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
codec | documentation | encoder and decoder available |
---|---|---|
MPEG-TS | link |