Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MediaCompressor

A Vencord plugin that catches videos and images too large for Discord's upload limit and offers to compress them before they are sent. Attach an oversized file the way you normally would and a prompt appears with three presets — Best, Balanced, Fast — each one guaranteed to fit under your limit, differing only in how hard ffmpeg works and how much resolution is kept. Pick one, watch the progress bar, and the compressed file lands in the composer ready to send.

Discord never sees the oversized original, so its own "Your files are too powerful" error never appears and the send button is never greyed out.

Works on Discord Desktop and Vesktop, both tested.

It also trims. Attaching any video — whatever its size — opens a preview with a range selector, so you can cut to the part you actually want to send. Because trimming shrinks the file, watching the selection shorten can make compression unnecessary altogether: the presets disappear the moment the clip fits. A trim on its own is lossless and near-instant, since nothing is re-encoded.

Install

Third-party plugins only work in a Vencord you build yourself — the normal installer cannot load them. Vencord's own guides are the authority here:

Vencord notes that this route is for advanced users and that custom plugins are not officially supported. The steps below are those guides applied to this plugin.

1. PrerequisitesGit, Node.js and pnpm. Check them with git --version, node --version, pnpm --version.

2. Build Vencord from source

git clone https://github.com/Vendicated/Vencord
cd Vencord
pnpm install --frozen-lockfile

3. Add this plugin. src/userplugins does not exist yet, so create it. The folder name must stay exactly mediaCompressor.desktop:

mkdir -p src/userplugins
git clone https://github.com/Voruzhu/mediaCompressor.desktop src/userplugins/mediaCompressor.desktop

The .desktop suffix is not decoration — Vencord's build reads it to include the plugin for Discord Desktop and Vesktop while excluding it from web builds, where it cannot work. A plain git clone already names the folder correctly.

4. Build and install

pnpm build
  • Discord Desktop: run pnpm inject, which launches the installer to patch Discord.
  • Vesktop: open Vesktop Settings → Vencord LocationChange, and pick the dist folder inside your Vencord directory.

Restart the client and enable MediaCompressor in the plugins tab.

Take Vencord's warning seriously: never leave an empty folder or empty plugin file in src/userplugins. It breaks the build with TypeError: Cannot read properties of undefined (reading 'localeCompare').

To update later, git pull inside the plugin folder and run pnpm build again.

Requirements

ffmpeg and ffprobe. The plugin finds them automatically if they are on your PATH or in a conventional install location. If you do not have them:

Platform Command
Windows winget install Gyan.FFmpeg
macOS brew install ffmpeg
Linux sudo apt install ffmpeg

You can also point the plugin at specific binaries with the ffmpeg path and ffprobe path settings.

Compatibility

Discord Desktop and Vesktop are both supported, and both are tested — compression, trimming and the Pixeldrain upload were each verified on the two clients rather than assumed to carry over.

Not the web version. The plugin runs ffmpeg in Electron's main process, which Vencord on web has no access to. The folder's .desktop suffix tells Vencord's build exactly that: include it for both desktop clients, exclude it from web.

If you use both clients, they share one ffmpeg download and one Pixeldrain API key. Those live in a MediaCompressor folder under your roaming app data rather than inside either client's own directory, so installing on the second client costs nothing.

Network use disclaimer

The plugin makes no network requests during normal use. Detection, probing, compression, and attachment are all local.

There is exactly one exception, and it only runs when you click a button. If ffmpeg is missing, the prompt offers a Download ffmpeg button. Pressing it downloads a version-pinned build from github.com/BtbN/FFmpeg-Builds into Discord's app data folder.

That download is pinned to a specific immutable release tag, never latest, and its expected SHA-256 is hardcoded in acquire.ts. The digest is checked before the binary is made executable or run; on a mismatch the download is deleted, both digests are reported, and nothing is installed. You can read the exact URLs and hashes in that file.

macOS does not offer the download. The conventional macOS static-build host is a single-maintainer service with no stable pinned URL and published digest, so rather than fetch something unverifiable, macOS is detect-only and points you at Homebrew.

Pixeldrain uploads

The plugin can also upload files to pixeldrain.com, an external service. This is off by default, does nothing until you add your own API key, and never happens without you clicking the button — there is no automatic mode.

When you do use it, the file leaves your computer and is stored on Pixeldrain's servers under your own account. You are responsible for what you upload. Pixeldrain's abuse policy prohibits copyright violation, abuse of minors, terrorism, gore, malware, doxing and revenge porn, and violations are punished with an upload ban.

When an upload finishes, the link arrives as a Discord notification in the bottom-right corner. It is copied to your clipboard automatically, so pasting works without touching anything, and clicking the notification drops it into the message box you were sending from. The notification stays until you dismiss it.

Two ways a Pixeldrain link differs from a Discord attachment, both stated in the plugin's own dialogs rather than left to surprise you:

  • Files are deleted after 60 days without a download. A download resets the timer, but only once per 24 hours. The link will not last forever.
  • Recipients see a CAPTCHA unless you or they have Pixeldrain premium, and free-tier download bandwidth is rate-limited per IP.

Your API key is stored by the plugin's native side in a shared MediaCompressor folder under your roaming app data — shared deliberately, so Discord Desktop and Vesktop use one key and one downloaded ffmpeg between them rather than a copy each. It is not in Vencord's settings.json — that file is plaintext and people routinely export, sync and share it when asking for help, and the key grants access to your Pixeldrain account. The key is never sent to the Discord client either: the upload runs in the Electron main process, and the settings panel can only set it, clear it, or ask whether one exists.

Settings

Detection — enable for video · enable for images · offer to trim videos when attaching them, whatever their size (on by default) · limit source (auto-detect or a manual MB value) · always target 10 MB, so recipients on free accounts can still view the file · safety margin percent.

Prompt — prompt mode: always ask, ask only when the estimate is slow, or never ask and compress automatically · which preset auto-compress uses · the slow-encode threshold in seconds.

Encoding — ffmpeg path · ffprobe path · video codec (H.264 / H.265 / AV1) · hardware encoder (auto, off, NVENC, QuickSync, AMF, VideoToolbox) · max resolution · max fps · audio bitrate · strip audio · image format policy · image max dimension.

Files — output location · retain the output after sending · open the output folder when done. Temp plus retain-off is the default and leaves nothing behind; a chosen folder plus retain-on turns the plugin into a compression archive.

Auto-compress

With prompt mode set to never ask, no modal appears: a progress toast runs while the file encodes, then the compressed file is attached to the composer. You still type your caption and press Enter. The plugin never sends a message on your behalf.

Trimming

The modal shows the video with two handles. Dragging either one seeks the preview to that exact frame, and Play selection loops just the part you have chosen. The projected size updates as you drag.

A trim on its own uses ffmpeg's stream copy: nothing is decoded or re-encoded, so it finishes almost instantly on a large file and loses no quality. The trade-off is that the cut snaps to the nearest keyframe at or before your start point, which can be a few seconds earlier depending on how the video was encoded. When compression is needed too, the trim folds into that re-encode instead and lands exactly where you put it.

Attach as-is sends the original untouched, and Esc does the same.

How images are handled

Images are a different problem from video — a large PNG shrinks by changing format, not by lowering bitrate. So:

Source Output
Has an alpha channel WebP, falling back to optimised PNG
No alpha JPEG or WebP, whichever is smaller
Animated GIF or APNG MP4 or animated WebP

Quality is found by bisection until the result lands under budget. Set image format policy to keep original format if you would rather the extension never changed.

Development

npm install
npm test        # vitest, covers all the pure decision logic
npm run typecheck

The encoding maths, resolution ladder, image format selection, limit resolution, digest verification, and generated ffmpeg argv are all pure functions with no Discord or ffmpeg dependency, and are unit-tested. The type-check reports unresolved @api/..., @utils/..., and @webpack/... imports when run standalone — those are Vencord's path aliases and resolve inside Vencord's build.

Two layout constraints, both learned the hard way:

  • The TypeScript config is named tsconfig.dev.json, not tsconfig.json. esbuild resolves Vencord's @utils/... aliases using the nearest tsconfig.json above each source file, so a tsconfig.json in this folder shadows Vencord's and the build fails with Could not resolve "@utils/types".
  • This folder must be a real directory inside src/userplugins, not a symlink or a Windows junction. esbuild resolves links to their real path, which lands outside Vencord's tsconfig tree, and the aliases then fail for exactly the same reason. Develop the plugin in place; if you want it reachable from elsewhere, link to it rather than linking it in.

Manual test checklist

  • Drag-drop an oversized video — modal appears
  • Paste an oversized video from the clipboard — modal appears
  • Attach an oversized video via the + picker — modal appears
  • Attach an under-limit image — no modal, uploads normally
  • Each preset produces a file under the limit
  • Cancel mid-encode — no attachment, no leftover temp files
  • Rename ffmpeg so it cannot be found — onboarding modal appears
  • Corrupt a digest in acquire.ts — download aborts and reports the mismatch
  • Auto-compress mode attaches without a modal and does not send
  • Multiple oversized files in one drop are all handled, and labelled as a batch
  • Oversized animated GIF converts to a playable MP4
  • Oversized PNG converts to WebP or JPEG
  • Works in Vesktop as well as Discord Desktop
  • Disabling the plugin restores Discord's normal upload behaviour
  • Attach an under-limit video — trim modal appears with no presets
  • Attach an oversized video — trim modal appears with presets below
  • Drag the handles until the projected size fits — presets disappear
  • Preview seeks to the frame at each handle as you drag it
  • Play selection loops within the range
  • Attach as-is leaves the file completely untouched
  • Turn off "Offer to trim videos" — only oversized files prompt
  • Oversized non-media file offers the Pixeldrain upload
  • A finished upload notifies bottom-right with the link
  • Staged sources are removed from temp once a job finishes
  • Large files stage in chunks without exhausting memory
  • Clicking the notification inserts the link into the message box
  • A deliberately wrong API key reports Pixeldrain's own rejection
  • Two oversized archives at once — both upload, both links shown
  • Cancel mid-upload — nothing attached, no partial upload kept

Licence

GPL-3.0-or-later, matching Vencord. See LICENSE.

About

Vencord plugin for files Discord won't take: compress with presets that always fit, trim with a live preview, or upload the rest to Pixeldrain. Discord Desktop and Vesktop.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages