Project

go-264

experimental

H.264/AVC decoder in pure Go, with tracing and FFmpeg comparison tools.

Overview

go-264 decodes progressive 8-bit YUV420 H.264/AVC streams in Go, with command-line inspection tools and an independent audio package. The video decoder accepts Annex B streams and reconstructs frames without FFmpeg at runtime.

The audio package handles mono/stereo integer PCM WAV and limited progressive AAC-LC or AC-3 audio in MP4/MOV files.

How it works

Annex B scanning and NAL parsing feed SPS/PPS and slice parsing, CAVLC/CABAC entropy decoding, prediction, transforms and reconstruction. Deblocking and the decoded-picture buffer maintain the state needed for later pictures.

Inspection tools export PNG/YUV and compare syntax or output with FFmpeg during offline validation. The separate audio import does not depend on the video decoder. Its audio API checks container and codec limits before and during decoding.

Features
→
H.264 reconstruction

CAVLC and CABAC, I/P/B pictures, intra/inter prediction, weighted prediction, integer transforms and deblocking for supported progressive streams.

→
Independent audio API

Integer PCM WAV and limited progressive AAC-LC/AC-3 MP4/MOV decoding through a standalone Go package.

→
SIMD kernels

Selected amd64 and arm64 kernels accelerate transforms, prediction and motion work, with scalar paths.

→
Inspection tools

Export frames, record syntax traces and compare decoder output with offline FFmpeg references.

→
Explicit limits

The decoder targets progressive 8-bit YUV420 streams. Interlaced/MBAFF and FMO are unsupported; no encoder is included.

Architecture
Annex B stream NAL · SPS · PPS Slice syntax I · P · B headers Entropy decode CAVLC / CABAC Reconstruction predict · transform · deblock Frame + DPB YUV420 · references Decode + compare PNG · YUV · traces · PSNR H.264 decode path with trace and validation tools