> ## 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.

# Installation

> Add gortsplib to your Go project.

## Requirements

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

```bash theme={null}
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:

<CodeGroup>
  ```bash go get theme={null}
  go get github.com/bluenviron/gortsplib/v5
  ```

  ```bash go get (specific version) theme={null}
  go get github.com/bluenviron/gortsplib/v5@latest
  ```
</CodeGroup>

## Start a new project

If you are starting from scratch, initialize a module first and then fetch the library:

```bash theme={null}
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:

```go main.go theme={null}
package main

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

func main() {}
```

Run:

```bash theme={null}
go build ./...
```

If no errors appear, the installation succeeded.

## CGO requirement for some examples

<Note>
  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.
</Note>

To install the required libraries on Debian or Ubuntu:

```bash theme={null}
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.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.