Skip to main content

Requirements

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

Module path

The current major version is v5:

Add the dependency

Run go get inside your module to add gortsplib:

Start a new project

If you are starting from scratch, initialize a module first and then fetch the library:
This creates a go.mod that includes:

Verify the installation

Create a minimal main.go that imports the library and compiles cleanly:
main.go
Run:
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:
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.