Skip to content

Video (Windows): play VP9-with-alpha WebM instead of refusing it #862

Closed

Description

@houko

Context

On Windows, core.Video refuses any local clip that declares alpha: internal/platform/windows/video.go:221 checks videoalpha.Source and reports EventError with VideoErrorAlphaUnsupported (alphaRefused, :264), because Media Foundation's alpha output for VP8/VP9 (the alpha stream in Matroska BlockAdditions, BlockAddID 1) and HEVC (the alpha layer) has never been checked on a Windows machine. The comment points apps to decoding the clip themselves (#107).

macOS plays HEVC with alpha and Linux plays VP9 with alpha in WebM through GStreamer (codecalpha), so Windows is the only desktop where a transparent clip cannot be played through core.Video.

Why it matters

nsgo-pet (https://github.com/nsgo-dev/nsgo-pet) is a desktop pet whose every clip is VP9 with alpha in WebM: on Windows the window stayed empty. It now works around this with its own player (nsgo-dev/nsgo-pet#13): ebml-go demuxes the WebM, libvpx (an MSYS2 libvpx-1.dll loaded with purego, plus libwinpthread-1.dll) decodes the colour and the alpha streams, and the frames go to a core.Image through ImageSource.Pixels on their timestamps. That is about 500 lines and two bundled DLLs per app, and it has to re-create what core.Video gives (first-frame load event, progress, end, pause, rewind, Contain sizing).

Measured on a Windows 11 VM: decoding one 640x360 frame with alpha takes about 1.7 ms with libvpx, and the decoded pictures match ffmpeg's.

Media Foundation itself is unlikely to help for VP9: its Matroska source is not known to pass BlockAdditions, so the alpha stream would be dropped, which is the opaque picture the comment fears.

Proposal

Play VP8/VP9-with-alpha WebM on Windows in NSGo itself instead of refusing it, for example the way nsgo-pet does: demux the WebM, decode both streams with libvpx (loaded without cgo), and draw the premultiplied BGRA frames in the video view, keeping core.Video's events and controls. HEVC with alpha can stay refused until it is checked.

Acceptance

  • A VP9-with-alpha WebM plays in core.Video on Windows with its transparent areas transparent, and fires OnLoad, OnProgress and OnEnd as on the other desktops.
  • VideoErrorAlphaUnsupported is reported only for codecs that are still unchecked.
  • The docs say which alpha codecs each desktop plays.

Activity

  1. self-assigned this
    on Nov 19, 2026
  2. houko commented on Nov 19, 2026

    @houko
    CollaboratorAuthor

    Reviewed against current origin/main. The Windows backend intentionally rejects every local source declaring alpha in internal/platform/windows/video.go before creating Media Foundation's media engine. Its frame-server path transfers Media Foundation frames into Direct2D with alpha ignored, and the repository has no Windows VP8/VP9 alpha decoder, WebM demuxer, libvpx dependency, or alternate video frame transport. The only alpha support is platform decoder behavior on macOS/Linux, while the roadmap explicitly lists transparent Windows videos as a future stage of #569/#107.

    Implementing this issue requires a new Windows decoding and rendering subsystem, including licensing/dependency decisions, playback controls and event parity. It cannot be completed as an isolated fix with the current backend. I am closing this issue so that the roadmap item can be reopened as a scoped decoder project when that subsystem is ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions