defnotmid

Projects / 04

oicut

Native Odin media codecs and containers. Video, audio and image decoding and encoding with no FFmpeg or other codec library at runtime.

  • Odin
  • MIT
  • no FFmpeg
  • Vulkan Video
  • VideoToolbox
  • Linux · Windows · macOS
28 seconds of oicut at 60 fps, on West London broken beat in F minor at 112 BPM: ProRes 4444 and VP9 alpha composited live, an 11158×2156 WebP panned across the frame, and the encode and decode numbers. oicut's demo/ at d3df5b8c (v0.0.21), rendered by onimite v0.0.72, which decodes its clips and encodes its output with oicut. Samples, all CC0: Virtuosity Drums by Versilian Studios and Karoryfer Samples, Growlybass by Karoryfer Samples, and the Versilian Community Sample Library and VS Chamber Orchestra 2: Community Edition by Versilian Studios.

By the numbers

ProRes 4444 + alpha, 1080p
329 fps
through RGBA, 8 threads (89 fps on one)
per 1080p H.265 frame, Vulkan Video decode
1.40 ms
three in flight (2.46 ms one at a time); FFmpeg's Vulkan Video takes 1.87
native H.264 encode, 1080p, QP 27
176 fps
16 slices on 16 workers; x264 medium with the same tools does 226
WebP corpus files
131 / 131
RGBA-identical to dwebp

Figures from oicut v0.0.22's BENCHMARKS.md (bash tests/compare.sh, measured 2026-10-27, AV1 against dav1d 2026-11-02, on a Ryzen 9 9900X3D and an RX 9070 XT) and its image/webp README.

What's in it

  1. 01One API over everything

    media encodes and decodes through the native codecs, the system's or the hardware's, choosing what the machine supports.

  2. 02Hardware when it's there

    Vulkan Video sessions for H.264, H.265 and AV1 on Linux, VideoToolbox H.264 and HEVC decoding and encoding on macOS, the native codecs as the software path.

  3. 03Movie files in one call

    video turns RGBA or planar frames and f32 PCM into MP4 or WebM and back, with frame-accurate seeking.

  4. 04Patented formats on request

    Native H.264 and H.265 are compiled in only with -define:OICUT_PATENTED=true. A default build leaves them out and sends both formats through Vulkan Video or VideoToolbox.

  5. 05Your threads, not ours

    Parallel work runs on the caller's common.Work_Pool. The codecs never create threads of their own.

  6. 06Plain Odin

    The native codecs and containers build for Linux, Windows and macOS with nothing else to install.

  7. 07A player included

    viewer is an SDL3 player for every format oicut reads.

Formats

Video

H.264
encode progressive 8-bit 4:2:0, decode 4:0:0 to 4:4:4 at 8 to 10 bits and lossless, encoder checkpoints for editing
H.265
encode + decode, Main, Main 10 and range extensions, alpha layers
ProRes
decode, 422 and 4444/XQ with alpha
VP9
decode, profiles 0–3, alpha streams; encode, profile 0 with alpha
AV1
decode, profiles 0–2 at 8 to 12 bits, identical to dav1d on 11 libaom, SVT-AV1 and rav1e test streams, in 1.36× its time on one core; encode to MP4, its qp on H.264's scale, and against v0.0.22 at equal PSNR 13.3% fewer bits on 1080p camera footage (in about 40% more time) and 27.6% on a motion-graphics clip; hardware decode through Vulkan Video

Audio

AAC-LC
encode + decode, 1 to 8 channels
Opus
decode: SILK, hybrid, CELT, loss concealment, FEC, DTX, surround; encode, CELT only (music): against libopus's CELT-only encoder, the same rate and 0 to 0.03 dB higher SNR from 32 to 192 kb/s, in about its cycles on one core
FLAC
4 to 32 bits
ALAC
decode, 16, 20, 24 and 32 bits, 1 to 8 channels
MP3
MPEG-1/2/2.5 Layer III
Vorbis
decode

Images

WebP
lossy, lossless, alpha and animation to RGBA8
JPEG
baseline and progressive, identical to libjpeg-turbo
GIF
the first frame, or the animation composited as browsers show it
PNG
decode + write
BMP · TGA · QOI
decode to RGBA8
Radiance HDR
decode to linear f32

Containers

MP4 / MOV
read (fragmented MP4 too) + write
WebM / Matroska
read, and VP9 WebM write with alpha and Opus sound
Ogg
for Ogg Opus and Ogg Vorbis
WAV
WAV, RF64 and RIFX read, 16-bit PCM and float write

Some packages are ported from permissively licensed projects (libopus, libwebp, Apple ALAC, minimp3, PDMP3, gen2brain/h265, oxideav-h265, Kvazaar, OpenH264); their notices are kept beside the code.

Use it

import video "deps:oicut/video"   // -collection:deps=.. (the directory holding oicut)

config := video.default_writer_config(1920, 1080, 30000, 1001) // qp 23, faststart
config.codec = .H264                 // or .H265
config.sample_rate, config.channels = 48000, 2
w: video.Writer
err := video.create(&w, "out.mp4", config)   // or create_stream
err = video.write_audio(&w, pcm)     // any amount, any time
for frame in frames do err = video.write_frame(&w, frame.rgba, frame.width * 4)
err = video.finish(&w)
video.destroy(&w)

The family