goav1 is a pure-Go AV1 decoder, general-purpose & realtime encoder, and WebRTC RTP/RTCP toolkit.
- Zero cgo, zero assembly (
.s/.S), zero third-party dependencies in the root module. - Go-native SIMD (
GOEXPERIMENT=simdviasimd/archsimd) for arm64 and amd64, with portable pure-Go fallbacks. - Memory-safe & GC-free on hot paths —
unsafeis strictly isolated ininternal/unsafeutil(scripts/check_unsafe.sh), with 0 allocs/frame in steady-state decode and encode. - Bit-exact conformance — strict MD5 parity against
dav1d --filmgrain 1across 130+ AV1 feature vectors and real-content streams.
Measured end-to-end via CLI binaries (-pgo=cmd/qualitybench/default.pgo) against dav1d 1.5.4, libaom (aomdec / aomenc), and SvtAv1EncApp with matched null output muxers, interleaved runs, bit-exact MD5 verification, and FFmpeg PSNR/SSIM scoring. Ratios are goav1 / reference (< 1.00× means goav1 is faster / uses fewer resources).
| Workload | Reference | Wall | Cycles | Instructions | Notes & Quality |
|---|---|---|---|---|---|
| Decoder (7-stream quick suite, 1T) | dav1d 1.5.4 |
1.11× | 1.11× | 1.42× | Realtime/SVT 1.10× wall (svtra_mtbike 1.04×, svtrtc_crowdrun 1.05×); aomgood_parkjoy 1.58× wall / 1.61× cyc; 0 allocs/frame |
| Decoder (7-stream quick suite, 8T) | dav1d 1.5.4 |
1.02× | 1.05× | 1.39× | Beats dav1d on 4/7 streams (aomrt_johnny 0.95×, svtra_mtbike 0.97×, svtrtc10_crowdrun 10-bit 0.97×, svtrtc_crowdrun 0.99×); Realtime/SVT 1.01× total; 0 allocs/frame |
| Decoder (7-stream quick suite, 1T / 8T) | aomdec (libaom 3.15.2) |
0.73× / 0.30× | — | — | Faster than aomdec on every stream at 1T (incl. aomgood_parkjoy at 0.93×) and 3.3× faster at 8T; 100% MD5 parity |
| Encoder (720p 240f RTC CBR 1000k, 1T) | SvtAv1EncApp v4.2.0 p12 RTC |
0.78× | 0.65× | 0.98× | Beats SVT-AV1 on every metric: 0.88× user CPU, 23.45G vs 23.86G ins, +0.74 dB PSNR-Y (40.80 vs 40.06 dB); 0 allocs/frame |
| Encoder (720p 240f RTC CBR 1000k, MT) | SvtAv1EncApp v4.2.0 p12 RTC |
0.48× | 0.82× | 1.12× | 2.1× faster wall time, matched user CPU (1.00×); 0 allocs/frame |
| Encoder (720p 240f RTC CBR 1000k, 1T / MT) | aomenc --rt --cpu-used=10 |
0.52× / 0.54× | 0.44× / 0.53× | 0.47× / 0.50× | 1.9× faster, lower RSS (36.4M vs 41.0M at 1T); aomenc achieves +2.26 dB higher PSNR-Y at matched bitrate |
Reproduce locally with make bench-e2e (quick suite), make bench-e2e-fast (rapid iteration), or make bench-e2e-full (all 42 8-bit + 5 10-bit streams). See docs/e2e-codec-gap-20261124.md for the full quiet-machine breakdown and per-stage profiles.
| Feature | Decoder | Encoder |
|---|---|---|
| Profiles 0, 1, 2 (8/10/12-bit; 4:2:0, 4:2:2, 4:4:4, Monochrome) | Full | Full (VideoEncoder, HighBitDepthVideoEncoder, MonochromeVideoEncoder, HighBitDepthMonochromeVideoEncoder) |
| Lossless (qindex 0, WHT, no in-loop filters) | Full | Full (Lossless: true, EncodeI420LosslessKeyframe) |
Rate Control (CQP, CRF, 1-pass CBR/VBR, 2-pass VBR, live SetQIndex/SetBitrate) |
— | Full (QIndex, CRF, TargetBitrate, VBR, Pass: 1/2) |
GOP & Frame Types (Key, Inter P, Hidden Alt-Ref, B-frame pyramid, show_existing_frame) |
Full | Full (BFrames, EncodeBatch, Flush) |
Scalability (SVC) (Temporal & spatial layers, operating_point_idc) |
Full (WithOperatingPoint, WithAllLayers, LayeredDecoder) |
Full (TemporalLayers, RTCEncoder) |
| In-Loop Filtering (Deblocking Loop Filter, CDEF) | Full | Full |
| Loop Restoration (Switchable Wiener + SGRProj) | Full | Full (EnableLoopRestoration, EncodeI420LoopRestorationKeyframe) |
| Super-Resolution (Horizontal scaling, denom 9..16) | Full | Full (SuperResDenominator, EncodeI420SuperResKeyframe) |
| Film Grain (Synthesis & noise modeling/signaling) | Full (WithFilmGrain) |
Full (FilmGrainLevel, EstimateFilmGrainParams, SetFilmGrain) |
| Screen Content (Palette coding, IntraBC) | Full | Full (Palette, EncodeI420IntraBCKeyframe) |
| Global Motion (Header signaling & translation estimation) | Full | Full (EnableGlobalMotion, EstimateGlobalMotionTranslation) |
HDR & Metadata (ColorInfo, HDR_CLL, HDR_MDCV, ITUT_T35, TIMECODE, SCALABILITY) |
Full | Full (Color, Metadata, SetMetadata) |
| Error Concealment & Live Push Streaming | Full (WithErrorConcealment, DecodePayload) |
Full |
| Transport & Framing (IVF, AV1 RTP, RFC 8285, RTX, RTCP, SDP) | Full | Full |
Container muxing/demuxing beyond IVF (MP4/ISOBMFF, WebM/MKV) and SRTP/ICE network transport stay with the caller.
Requires Go 1.27.4+ (GOEXPERIMENT=simd enables arm64/amd64 Go SIMD kernels; without it, portable pure-Go fallbacks are used).
go get github.com/thesyncim/goav1
GOEXPERIMENT=simd go build ./...package main
import (
"fmt"
"log"
"os"
av1 "github.com/thesyncim/goav1"
)
func main() {
ivf, err := os.ReadFile("input.ivf")
if err != nil {
log.Fatal(err)
}
frames, err := av1.DecodeIVF(ivf)
if err != nil {
log.Fatal(err)
}
for i, f := range frames {
fmt.Printf("frame %d: %dx%d\n", i, f.Width, f.Height)
}
}For zero-alloc streaming decode, use NewDecoderFromIVF + DecodeNext or push live low-overhead temporal units with Decoder.DecodePayload. Options: WithWorkers, WithMaxFrameDelay, WithFrameSizeLimit, WithFilmGrain, WithOperatingPoint, WithAllLayers, and WithErrorConcealment. See example_decode_simple_test.go.
package main
import (
"log"
av1 "github.com/thesyncim/goav1"
)
func main() {
const width, height = 64, 64
enc, err := av1.NewVideoEncoder(av1.VideoEncoderConfig{
Width: width, Height: height, CRF: 30,
})
if err != nil {
log.Fatal(err)
}
defer enc.Close()
frame := av1.I420Frame{
Y: make([]byte, width*height),
U: make([]byte, width/2*height/2),
V: make([]byte, width/2*height/2),
YStride: width, ChromaStride: width / 2,
Width: width, Height: height,
}
out, err := enc.Encode(frame, false)
if err != nil {
log.Fatal(err)
}
// Copy out.Data before the next Encode call if retaining it.
temporalUnit := append([]byte(nil), out.Data...)
_ = temporalUnit
}For WebRTC RTP packetization, dependency descriptors, and SVC, see RTCEncoder.
| API | Returned Data |
|---|---|
DecodeIVF |
Independent copies of visible Y/U/V samples |
Decoder.DecodeNext / DecodePayload |
Decoder-owned frame-pool memory (valid until next decode call) |
VideoEncoder.Encode |
Encoder-owned temporal-unit bytes (valid until next encode call) |
NewIVFIterator / OBU parsers |
Views into caller-provided input bytes |
Copy aliased buffers before retaining them or passing them across goroutines. Always Close() reusable Decoder, VideoEncoder, and RTCEncoder instances.
make build-cmd
./bin/aom-go-dec -haom-go-dec decodes IVF to raw YUV with -workers, -framedelay, -filmgrain, -oppoint, -conceal, and -cpuprofile. For SVC inspection, see cmd/dump_svc.
./scripts/check_unsafe.sh
make test
make ci-local
make testvectors-fastSee docs/quality-and-parity.md for the full conformance and benchmark gates, and SIMD_PORT.md for Go SIMD kernel details.
- Changelog · Quality & Parity · SIMD Port · Upstream Attribution · Security
- Licensed under BSD 2-Clause (LICENSE); libaom-derived portions also carry the AOM Patent License 1.0 (PATENTS). See NOTICE.