Skip to content

Compress for Discord

Khryz-Navarro edited this page Nov 9, 2026 · 1 revision

Status: Planned · Phase 2 of the Roadmap · Issue #29

What it does

Pick a video and a target size, and get a copy that fits, with as much quality as that size allows. Presets match Discord's upload limits; a custom size in MB works too.

How it would work

  • Where: in the Tools tab, next to Convert. It works on a file you pick, or on one you just downloaded.
  • Presets: Discord's limits at the time it's built. Today that's 10 MB without Nitro, with higher limits on Nitro plans; check them then, because Discord has changed them before.
  • The math:
    • total bits = target size × 8 × 0.95 (a 5% margin for the container);
    • audio bitrate = a fixed 96–128 kbps;
    • video bitrate = (total bits ÷ duration) − audio bitrate.
  • Encoding:
    • Two passes of H.264 (-pass 1, then -pass 2) give the most accurate size for the bitrate.
    • Output is MP4 with AAC, which plays inline in Discord.
  • Too little room:
    • If the bitrate would be too low to watch, below roughly 150 kbps at 480p, lower the resolution or frame rate automatically.
    • If even that's not enough, say so: "This video is too long for 10 MB; trim it first", with a link to Trim & crop.
  • The code:
    • A pure, tested compress_plan(duration, target) in src/ytdlp.rs returns the bitrates and scale.
    • The encode reuses the Convert runner: progress, pause, cancel.
  • The check: after encoding, the file's size is compared with the target. If it's over, it's encoded again with a 5% lower bitrate.

Open questions

  • Should a one-pass mode exist for speed, giving a less exact size?
  • Should H.265 or AV1 be offered for better quality at the same size? Discord's inline player doesn't play all of them on every device.

Risks

  • Discord changes its limits. Keep the presets in one list, so changing them takes one edit.
  • Very long videos: a ten-minute video in 10 MB looks bad whatever you do. The app has to say so instead of producing something unwatchable.

Home

Roadmap

Phase 1: links you paste

Phase 2: tools for your files

Phase 3: new engines

Phase 4: beyond the desktop

Clone this wiki locally