Skip to content

RTSP 1.0 client and server library for the Go programming language

License

Notifications You must be signed in to change notification settings

bluenviron/gortsplib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gortsplib

Test Lint Go Report Card CodeCov PkgGoDev

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

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 ✔️
VP9 link ✔️
VP8 link ✔️
H265 link ✔️
H264 link ✔️
MPEG-4 Video (H263, Xvid) link ✔️
MPEG-1/2 Video link ✔️
M-JPEG link ✔️

Audio

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

Other

codec documentation encoder and decoder available
MPEG-TS link

Specifications

name area
RFC2326, RTSP 1.0 protocol
RFC7826, RTSP 2.0 protocol
RFC8866, SDP: Session Description Protocol SDP
RTP Payload Format For AV1 (v1.0) payload formats / AV1
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 video, MPEG-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
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
Codec specifications codecs
Golang project layout project layout

Related projects