Skip to main content

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.

Requirements

gortsplib requires Go 1.25 or later. Check your installed version with:
go version

Module path

The current major version is v5:
github.com/bluenviron/gortsplib/v5

Add the dependency

Run go get inside your module to add gortsplib:
go get github.com/bluenviron/gortsplib/v5

Start a new project

If you are starting from scratch, initialize a module first and then fetch the library:
mkdir myrtspapp && cd myrtspapp
go mod init myrtspapp
go get github.com/bluenviron/gortsplib/v5
This creates a go.mod that includes:
module myrtspapp

go 1.25.0

require github.com/bluenviron/gortsplib/v5 v5.x.x

Verify the installation

Create a minimal main.go that imports the library and compiles cleanly:
main.go
package main

import (
	_ "github.com/bluenviron/gortsplib/v5"
)

func main() {}
Run:
go build ./...
If no errors appear, the installation succeeded.

CGO requirement for some examples

Most of gortsplib is pure Go and requires no C dependencies. A small number of example programs — such as the H264 encoder example — use FFmpeg via CGO. Those examples carry a //go:build cgo tag and require the FFmpeg development libraries to compile.
To install the required libraries on Debian or Ubuntu:
apt install -y libavcodec-dev libswscale-dev gcc pkg-config
You do not need CGO for reading or writing RTSP streams. The CGO dependency is only introduced when you use the optional FFmpeg-backed encoder helpers in the example code.

Build docs developers (and LLMs) love