Requirements
gortsplib requires Go 1.25 or later. Check your installed version with:Module path
The current major version is v5:Add the dependency
Rungo 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:go.mod that includes:
Verify the installation
Create a minimalmain.go that imports the library and compiles cleanly:
main.go
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.