Go video decoding library with **no runtime dependencies**. FFmpeg is statically linked — import the package and get a single binary, no system installs required.
// Open a decoder from any reader. If r also implements io.Seeker,
// FFmpeg will use it for random access where the format requires it.
funcNewDecoder(rio.Reader)(*Decoder,error)
// Returns duration, video/audio stream info. Safe to call before decoding.
func(d*Decoder)Meta()Meta
// Decode the next video or audio frame. Returns nil, nil on EOF.
// Frame.Video and Frame.Audio are mutually exclusive per call.
func(d*Decoder)DecodeFrame()(*Frame,error)
// Release all FFmpeg resources. Safe to call multiple times.
func(d*Decoder)Close()
```
### Types
```go
typeMetastruct{
Durationtime.Duration
Video*VideoMeta// nil if no video stream
Audio*AudioMeta// nil if no audio stream
}
typeVideoMetastruct{
Width,Heightint
FPSNum,FPSDenint
CodecNamestring
}
typeAudioMetastruct{
SampleRateint
Channelsint
CodecNamestring
}
typeFramestruct{
Video*VideoFrame
Audio*AudioFrame
}
typeVideoFramestruct{
Img*image.NRGBA
PTStime.Duration
Durationtime.Duration
}
typeAudioFramestruct{
Samples[]float32// interleaved
Channelsint
SampleRateint
PTStime.Duration
}
```
## Building from source
The `vendor/` directory contains prebuilt static libraries for all supported platforms. To rebuild from scratch, delete `vendor/` and use the build script:
Script clones necessary repositories (default dav1d mirror and FFmpeg mirror), builds them into static libraries for linking with CGO with preset of required parameters and produces a vendor directory.