Skip to content

Compress Video to 50 MB for Discord Nitro Basic

Choose or drop a video. You download a file smaller than 50 MB: MP4, or WebM in a browser that cannot encode MP4. The browser encodes the video, so no file is uploaded.

Full page version: joellof.com/compress-video/app/?limit=50mb

50 MB is the limit of Discord Nitro Basic.

The limits change, so check the help page of the service. Other limits:

  • Any size: type your own limit.
  • 8 MB: the old free limit of Discord, before 2023.
  • 10 MB: the free limit of Discord from 2024 to August 2026.
  • 20 MB: Discord.
  • 25 MB: Gmail and Outlook.
  • It fits the limit. The page picks the bit rate and the resolution from the length of the video, so the file is under 50 MB, not on it.
  • A long video. When the whole video cannot look good in 50 MB, the page says how many seconds fit and compresses the start of the video.
  • Any video that the browser reads: MP4, MOV, WebM and more. The download is <name>-50mb.mp4, or <name>-50mb.webm in a browser that cannot encode MP4.
  • Keep the audio, or turn it off to give all the bits to the picture.
  1. Mediabunny reads the video and its duration, size and audio in the browser.

  2. The page computes the bit rates that fit the limit. It keeps 5% for the container, gives the audio 128 kbit/s (64 kbit/s for a long video) and gives the rest to the video. It picks the largest resolution that the video bit rate can carry: 1080p, 720p, 480p or 360p, and never a larger one than the input.

  3. The page encodes with the first encoder that the browser has:

    • H.264 and AAC in MP4 with WebCodecs, on the GPU when the browser can. Mediabunny writes the MP4 file.
    • VP9 and Opus in WebM with WebCodecs, when the browser cannot encode H.264. Mediabunny writes the WebM file. Discord plays WebM.
    • H.264 and AAC in MP4 with FFmpeg (libx264, in WebAssembly), when the browser has neither. The page loads FFmpeg (about 32 MB) only then. One pass, with the bit rate capped, so the file lands near the target.

    When an encoder fails during the encode, the page says so and tries the next one. Only the last one shows its error.

  4. When the file is still over the limit, the page encodes again at a lower bit rate. When that bit rate is too low for the picture, it goes one step smaller: mono audio at 32 kbit/s, then 240p, then 15 frames per second. When even the smallest step is over the limit, the page says how many seconds fit. A long video starts at the step that fits, so the page trims a video only when even the smallest step is too large. A step never raises the frame rate of the video.

Every current browser works. Chrome, Edge and Safari encode H.264 on the GPU: a short clip takes seconds. A browser that cannot encode H.264 gets a WebM file. A browser with no video encoder of its own uses FFmpeg, which runs on one thread and can be many times slower than the video is long, so the page shows the time left. FFmpeg keeps the whole video in memory, so it takes videos up to 500 MB.

Language TypeScript
UI React
Platform Browser (WebCodecs, WebAssembly)
Key Deps Mediabunny (MPL 2.0), ffmpeg.wasm
Build Bun

Mediabunny reads and writes the media files. It is under the Mozilla Public License 2.0. ffmpeg.wasm (@ffmpeg/ffmpeg, @ffmpeg/core) encodes in a browser with no WebCodecs encoder. This server serves the FFmpeg core, so no CDN gets your files.

The FFmpeg core is @ffmpeg/core 0.12.10 of ffmpeg.wasm, under the GPL 2.0 or later. Its source is in the ffmpeg.wasm repository.

  • View Metadata: see the codec, the resolution and the bit rate of a video before and after.
  • Convert to WAV: take the audio of a video as a WAV file.