Shirei
Personal Software agents.md Blog GitHub

Shirei v0.10

Cross-platform video playback

2026.11.24

Shirei is a Go-based cross-platform GUI framework. Version v0.10.0 was released on 2026-11-24.

The main addition in this release is go.hasen.dev/shirei/media: cross-platform video playback across macOS, Windows, Linux, iOS, and Android. Video frames are presented as ordinary Shirei images through the GPU compositor, so translucent controls, labels, tooltips, and popups hover cleanly above playing video without native child-window z-order workarounds.

If you have Go installed, you can try the included video player example directly:

go run go.hasen.dev/shirei/examples/video_player@v0.10.0

Two constraints shaped the design of shirei/media:

Meeting both constraints across five operating systems turns out to be mostly a story about format and codec compatibility—what each OS gives you for free, where it falls short, and how to fill the gaps cleanly.

Format and OS compatibility matrix

Each cell below shows which decoding layer provides support on that platform:

OS Native platform decoder BSD Pure-Go demuxer + permissive BSD codec libs GSt Linux system GStreamer 1.0 / ffmpeg fallback Partial Depends on OS/distro packages or Store extension No Unsupported

Containers

Container macOS Windows Linux iOS Android
MP4 / MOV OS BSD OS BSD GSt BSD OS BSD OS
WebM BSD BSD GSt BSD BSD OS
MKV BSDAV1 / VPx BSDAV1 / VPx GSt BSD BSDAV1 / VPx PartialOS dependent
HLS (.m3u8) OS No No OS OS

Video codecs

Video Codec macOS Windows Linux iOS Android
H.264 (AVC) OS OS GStDistro plugins / OpenH264 OS OS
AV1 BSD+ OS on M3+ BSD+ Store ext GSt BSD BSD+ OS on A17 Pro+ OSAndroid 10+
VP9 BSD BSD+ Store ext GSt BSD BSD OS
VP8 BSD BSD GSt BSD BSD OS
HEVC (H.265) OS PartialPaid Store ext PartialDistro plugins OS OSAPI 21+

Audio codecs

Audio Codec macOS Windows Linux iOS Android
AAC OS OS GStDistro plugins OS OS
Opus BSD BSD GSt BSD BSD+ OS in MP4 OS
Vorbis BSD BSD GSt BSD BSD OS
MP3 OS OS GSt OS OS
FLAC OSin MP4 / MOV OS GSt OSin MP4 OS

Two format combinations work safely across all five native platforms:

On Web (Wasm), media.Open currently returns media.ErrUnsupported.

Why two layers: OS decoders + permissive BSD codecs

Relying on OS decoders alone leaves big holes in the matrix:

On the other hand, dropping OS decoders in favor of a single bundled software stack would either pull in LGPL/GPL FFmpeg or give up hardware-accelerated H.264 and HEVC on desktop and mobile.

Shirei combines both:

  1. The OS media framework handles patented and hardware-accelerated formats (H.264, HEVC, AAC, MP3, FLAC, HLS) wherever the OS provides them.
  2. A permissive fallback pipeline fills in the open web formats (WebM, MKV, and MP4 carrying AV1, VP9, VP8, Opus, or Vorbis). It is built from pure-Go MP4 and WebM/MKV demuxers paired with four BSD-2/3 codec libraries: libdav1d (AV1), libvpx (VP8/VP9), libopus (Opus), and libvorbis (Vorbis).

When media.Open is given a local file, Shirei sniffs the container header and track codecs before opening a decoder. If the file uses a container or codec that the platform's OS decoder cannot reliably play (such as WebM, VP8/VP9, AV1, Opus, or Vorbis), Shirei routes it directly to the permissive BSD pipeline instead of letting the OS decoder fail.

On desktop (macOS, Windows, Linux), those four BSD libraries are loaded dynamically at runtime via purego—so desktop builds stay CGO_ENABLED=0 and keep working even if a library is absent (they simply skip unavailable codecs). The loader checks SHIREI_CODEC_DIR, the executable's directory, macOS ../Frameworks, Homebrew, and standard system library paths.

How each platform works

macOS (CGO_ENABLED=0)

iOS (CGO_ENABLED=1)

Windows (CGO_ENABLED=0)

Android (CGO_ENABLED=1)

Linux (CGO_ENABLED=0 by default)

Linux is the trickiest desktop target because there is no single guaranteed media stack, and distributions differ sharply on patented codecs (Fedora and openSUSE ship without patented H.264/HEVC/AAC decoders by default unless the user enables extra repositories or Fedora's Cisco OpenH264).

Shirei handles Linux with an automatic layered fallback chain, where every default layer builds with CGO_ENABLED=0:

  1. System GStreamer 1.0 (purego): Loaded dynamically at runtime for in-process decoding and seeking. It automatically picks up whatever the user's distribution provides—including VA-API hardware acceleration, OpenH264, and installed codec plugins.
  2. Permissive BSD codecs (purego): Pure-Go WebM/MKV/MP4 demuxers + libdav1d / libvpx / libopus / libvorbis. Even on a minimal or patent-stripped distro without GStreamer plugins, WebM and MP4 with AV1/VP9/VP8 + Opus/Vorbis still play in-process.
  3. ffmpeg / ffprobe CLI subprocess fallback: Last-resort fallback if neither GStreamer nor the BSD codecs can open the file, using the ffmpeg binary on PATH if present.
  4. Opt-in -tags libav (CGO_ENABLED=1): For builds that explicitly opt into LGPL/cgo libavformat/libavcodec, Shirei also includes an in-process libav* backend with zero-copy VA-API dmabuf import into Wayland EGL/GLES.

In all Linux stream paths, decoded NV12 frames upload as two-plane Y/UV textures converted in the GLES fragment shader rather than converting YUV to RGBA on the CPU.

Other highlights in v0.10

While video playback is the centerpiece, building it pushed several general-purpose improvements into the core framework:

The agent-oriented manual has been updated for v0.10.0 (including the new video playback guide), and the full release notes are in the v0.10.0 changelog.