Skip to content

BlackOfWorld/webm-magic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

webm-magic

Create special WebM files that play different video or audio depending on the browser, by relying on how each browser’s internal parser handles the file.

Runtime: Bun

This project is intended to be run with Bun.

Scripts

Script Description
bun run start Run the CLI (recommended for creating files)
bun run cli Run CLI with workspace fix
bun run web Run the web app (Svelte SPA)
bun run dev Watch and serve the web app in dev mode
bun run build Build all packages (CLI + web)

CLI (recommended)

The CLI uses FFmpeg on your system and is much faster than the web app. Use it to create magic WebM files.

Requirements: FFmpeg must be on your PATH.

Run with no arguments or --help to show usage:

bun run start --
# or
bun run start -- --help

You must provide three video inputs (Chromium, Firefox, Android). Audio is optional: use either one shared audio track or per-platform audio. If any --audio-* option is used, all three --audio-chromium, --audio-firefox, and --audio-android are required.

Input formats: Video and audio inputs may be in any format that FFmpeg supports (e.g. .webm, .mp4, .mov, .mkv, .opus). Output is always WebM.

Recommended flags: For best compatibility (especially on Android), use --strip-cues or --remove-length in most cases. They avoid Cues-related issues that can cause playback problems. --remove-length is generally recommended.

bun run start -- --chromium chromium.webm --firefox firefox.webm --android android.webm [--audio audio.webm] --output magic.webm

Per-platform audio:

bun run start -- --chromium c.webm --audio-chromium ac.webm --firefox f.webm --audio-firefox af.webm --android a.webm --audio-android aa.webm --output magic.webm

With recommended flags:

bun run start -- --chromium c.webm --firefox f.webm --android a.webm --remove-length --output magic.webm

Web app

A browser-based Svelte app in packages/web lets you create magic WebM files using ffmpeg.wasm (no FFmpeg install required). Run it with bun run web or bun run dev for live reload.

Note: ffmpeg.wasm is currently slow; for faster processing, the CLI is recommended.

Special thanks to piousdeer

piousdeer created the original magic WebM videos that spread on Discord in 2022–2023. I reverse-engineered their work and built this tool. A notable example: piousdeer/magic.webm


This project is approximately 70% AI-generated; all research was done by me (BlackOfWorld). The repo includes an updated 010 Editor template (EBML.bt) for EBML/WebM, updated for newer versions and additional elements; it was used during the research.

About

Tool to create “magic” WebM files that play different content in Chromium, Firefox, and Android by exploiting parser differences.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors