How Discord Video Compression Works
AnyTool fits a video under Discord's upload cap in the browser with a self-hosted ffmpeg engine (no CDN). It uses single-pass average-bitrate (ABR) targeting: from the target size in MB, the clip duration and an audio budget it computes the video bitrate, then encodes with -b:v / -maxrate / -bufsize. When the required bitrate gets low it auto-downscales (720p → 480p → 360p) so quality stays usable, and after encoding it verifies the actual output bytes fit the cap, retrying once at roughly 10% lower bitrate if it overshot. Two-pass is avoided because it is flaky in wasm. The result is read back as an MP4 blob. Single-threaded is deliberate: the multi-threaded core needs SharedArrayBuffer + cross-origin isolation (COOP/COEP), which would block cross-origin ad iframes.
- Runs client-side — the video is never uploaded
- Self-hosted ffmpeg core — no CDN
- Single-pass ABR: videoK from target MB, duration, audio budget
- -b:v / -maxrate / -bufsize; auto-downscale (720/480/360) when low
- Verifies output bytes fit the cap; retries once ~10% lower if over
- Two-pass avoided (flaky in wasm); no backend, no signup
