RTSP 1.0 client and server library for the Go programming language, written for rtsp-simple-server.
Go ≥ 1.17 is required.
WARNING: the main branch contains code of the v2 version. The legacy v1 version is hosted in the v1 branch.
Features:
- Client
- Query servers about available media streams
- 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 only selected media streams
- Pause or seek without disconnecting from the server
- Generate RTCP receiver reports (UDP only)
- Reorder incoming RTP packets (UDP only)
- Publish
- Publish media streams to servers with the UDP or TCP transport protocol
- Publish TLS-encrypted streams (TCP only)
- Switch transport protocol automatically
- Pause without disconnecting from the server
- Generate RTCP sender reports
- Server
- Handle requests from clients
- Sessions and connections are independent
- Publish
- Read media streams from clients with the UDP or TCP transport protocol
- Read TLS-encrypted streams (TCP only)
- Generate RTCP receiver reports (UDP only)
- Reorder incoming RTP packets (UDP only)
- Read
- Write media streams to clients with the UDP, UDP-multicast or TCP transport protocol
- Write TLS-encrypted streams
- Compute and provide SSRC, RTP-Info to clients
- Generate RTCP sender reports
- Utilities
- Encode and decode format-specific frames into/from RTP packets. The following formats are supported:
- Video: H264, H265, VP8, VP9
- Audio: G711 (PCMA, PCMU), G722, LPCM, MPEG4-audio (AAC), Opus
- Parse RTSP elements: requests, responses, SDP
- Parse H264 elements and formats: Annex-B, AVCC, anti-competition, DTS
- Parse MPEG4-audio (AAC) element and formats: ADTS, MPEG4-audio configurations
- Encode and decode format-specific frames into/from RTP packets. The following formats are supported:
- client-query
- client-read
- client-read-options
- client-read-pause
- client-read-republish
- client-read-format-g711
- client-read-format-g722
- client-read-format-h264
- client-read-format-h264-convert-to-jpeg
- client-read-format-h264-save-to-disk
- client-read-format-h265
- client-read-format-lpcm
- client-read-format-mpeg4audio
- client-read-format-opus
- client-read-format-vp8
- client-read-format-vp9
- client-publish-options
- client-publish-pause
- client-publish-format-g711
- client-publish-format-g722
- client-publish-format-h264
- client-publish-format-h265
- client-publish-format-lpcm
- client-publish-format-mpeg4audio
- client-publish-format-opus
- client-publish-format-vp8
- client-publish-format-vp9
- server
- server-tls
- server-h264-save-to-disk
https://pkg.go.dev/github.com/aler9/gortsplib/v2#pkg-index
Related projects
- rtsp-simple-server https://github.com/aler9/rtsp-simple-server
- pion/sdp (SDP library used internally) https://github.com/pion/sdp
- pion/rtp (RTP library used internally) https://github.com/pion/rtp
- pion/rtcp (RTCP library used internally) https://github.com/pion/rtcp
Standards
- RTSP 1.0 https://tools.ietf.org/html/rfc2326
- RTSP 2.0 https://tools.ietf.org/html/rfc7826
- HTTP 1.1 https://tools.ietf.org/html/rfc2616
- Golang project layout https://github.com/golang-standards/project-layout