# libvlc-go for embedding VLC playback in a Go application

> libvlc-go gives Go applications a media player backed by native libVLC. Its versioned imports make the API family explicit, while deployment still depends on the target system’s VLC libraries.

**adrg/libvlc-go** — Handcrafted Go bindings for libVLC and high-level media player interface

- Repository: https://github.com/adrg/libvlc-go
- Website: https://pkg.go.dev/github.com/adrg/libvlc-go/v3
- Stars: 510 · Forks: 58
- Language: Go
- License: MIT
- Published: 2026-11-24 · Updated: 2026-11-24 · Language: en
- Canonical page: https://hysenlabs.com/projects/adrg-libvlc-go

## Where the Go player ends and libVLC begins

A desktop media application may need to respond when a track ends, change the media source from its own interface, or inspect the available tracks. The Go application needs access to the player state to do that. libvlc-go offers Go types and methods around libVLC, including a high-level player interface. This gives the application a place to connect its own controls to playback without having to write the binding layer itself.

The v3.1.6 sources show the native boundary directly. The cgo directives in v3/vlc.go and v3/player.go link against libVLC. The Go module expresses the API the application imports, while the C library provides the implementation underneath it. A dependency review therefore needs to include the native runtime as well as the code selected by Go modules. See the [v3.1.6 source](https://github.com/adrg/libvlc-go/tree/v3.1.6/v3).

## Select the Go module using the installed VLC API

The tagged README links to operating system instructions for installing the VLC SDK. Start with the instructions for the machine where the application will be built, since the native development files are required. For a project targeting libVLC 3.x, the README gives the following command to add the corresponding module to the Go project.

```bash
go get github.com/adrg/libvlc-go/v3
```

The application can then import the v3 package. The README maps libVLC 2.x to the separate v2 module and documents a legacy build tag for libVLC versions before 2.2.0. That older build path is specific to the 2.x instructions. When a build reports a missing native header or library, check the selected SDK and compiler environment alongside the Go dependency. The v3 module download addresses the Go side of that dependency. See the [tagged installation instructions](https://github.com/adrg/libvlc-go/tree/v3.1.6#installation).

## Follow one media item through the upstream player

The basic player example initializes the library before creating a player. It shows how the same player can load a local file or a URL. For a first check using a file you control, follow the commented local-path option in the example and substitute a real file path. Use a short audio file for this check because the example initializes the library with video disabled.

The example installs a MediaPlayerEndReached callback before calling Play. The callback closes the channel the main function waits on, so the example keeps the process alive while the media plays and exits its wait at the end of the track. That makes it a better first integration check than a program that calls Play and immediately returns. The sample also detaches the event registration and releases the native objects during cleanup. See [basic player usage](https://github.com/adrg/libvlc-go-examples/blob/master/v3/player/player.go).

## Keep the player lifecycle tied to the application

The basic example owns a single player and expects a single completion. In an application with a long-lived window, a completion callback might instead update the visible track state or start the next item. This changes the owner of the wait and cleanup. The sample gives the call order and cleanup operations, while the application decides when the player should stop and how it should handle a user action during playback.

The upstream examples provide separate starting points for list playback, event handling and GTK interfaces. That separation matters when estimating the work of embedding video in an existing window. The basic example establishes that the binding can drive playback with a native library present. A GTK example is a closer reference for how a GUI application connects the player to its own interface. See the [example collection](https://github.com/adrg/libvlc-go-examples/tree/master/v3).

## Decide whether playback needs to live in the Go process

An alternative for an application that only needs to open a media file is to start the VLC executable as a separate process. In that design the Go program owns the child process and VLC owns the playback window. With libvlc-go, the Go program can instead use the player and event manager from its own process. The difference shows up as soon as a Go interface must react to the end of an item or change its media without opening another process.

The binding repository includes an MIT license. The packaging work also involves the separately installed libVLC component. A release checklist should pair the intended Go module version with the libVLC API family and confirm that the libraries are available when running the deployed binary. For an upgrade, repeat the short playback check in the intended deployment image so the test exercises the native dependency as well as the Go import. See the [binding license](https://github.com/adrg/libvlc-go/blob/v3.1.6/LICENSE).

## Conclusion

Use libvlc-go when playback state and events belong in a Go application that can ship the native VLC dependency. For occasional playback in a separate window, a child process may be enough. Before committing to the binding, build and run the upstream player example on the same system image that will run the application.

## FAQ

### Which libVLC version does libvlc-go v3 target?

The v3 Go module implements bindings for libVLC 3.x. The repository provides a separate v2 module for libVLC 2.x.

### Does installing the libvlc-go module supply the native SDK?

The README lists the libVLC development files as a separate prerequisite and links to operating system instructions.

### Can libvlc-go play a local file?

Yes. The basic player example shows LoadMediaFromPath as the local-file counterpart to LoadMediaFromURL.

## Sources

- [adrg/libvlc-go on GitHub](https://github.com/adrg/libvlc-go)
- [License: MIT](https://github.com/adrg/libvlc-go/blob/master/LICENSE)
- [Project website](https://pkg.go.dev/github.com/adrg/libvlc-go/v3)
- [README](https://github.com/adrg/libvlc-go/blob/master/README.md)
- [Releases](https://github.com/adrg/libvlc-go/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/adrg-libvlc-go
