https://github.com/Lensual/go-libav
[WIP] Golang binding for FFmpeg and libav
https://github.com/Lensual/go-libav
ffmpeg libav libavcodec libavformat libavutil
Last synced: 7 months ago
JSON representation
[WIP] Golang binding for FFmpeg and libav
- Host: GitHub
- URL: https://github.com/Lensual/go-libav
- Owner: Lensual
- License: lgpl-2.1
- Created: 2021-09-17T07:01:56.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-01-21T19:51:19.000Z (about 2 years ago)
- Last Synced: 2024-08-07T23:47:26.281Z (over 1 year ago)
- Topics: ffmpeg, libav, libavcodec, libavformat, libavutil
- Language: Go
- Homepage:
- Size: 439 KB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DEPRECATED
根本没有必要开发这个库。不如直接在Go项目里写C模块。对于不会C和不熟悉手动内存管理的Go开发者,不如直接调用命令。
# go-libav
[](https://pkg.go.dev/github.com/Lensual/go-libav)



[](https://goreportcard.com/report/github.com/Lensual/go-libav)

[English](./README.md) | [中文](./README_zh.md)
Golang binding for [FFmpeg and libav](https://ffmpeg.org/).
## Things to know
1. This package is implemented using CGO and requires FFmpeg's header files and libraries for compilation.
2. Due to well-known performance issues with CGO calls, it is recommended to use C/CPP to achieve your needs.
## Getting Started
Package `go-libav/av*` are cgo bindings. Before using this package, you'd better to master the basic usage of the FFmpeg library.
Package `golibav/advance` is a secondary package to simplify use in go.
Need Golang version `1.21` and FFmpeg library version `6.1`.
Set your environment variable if your library is not in the default directory.
```env
# using pkg-config
PKG_CONFIG_PATH="/ffmpeg/lib/pkgconfig"
# or set compiler flags
CGO_LDFLAGS="-L/ffmpeg/lib -lavcodec -lavdevice -lavfilter -lavformat -lavutil -lswresample -lswscale"
CGO_CFLAGS="-I/ffmpeg/include"
```
## Examples
Check [advance/example](./advance/example) directory.
Try examples With Docker
```bash
# Run container with Debian 13 (trixie).
sudo docker run --rm -it debian:trixie
# Install development environment.
apt install golang git
# Clone project.
git clone https://github.com/Lensual/go-libav
# Install FFmpeg development libraries.
apt install libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev
# Build example like 'mux' and then run iut.
cd go-libav/example/mux
go build .
./mux ./test.mp4
```
## License
[GNU Lesser General Public License version 2.1](./LICENSE)