One-Click Resize Videos for Discord using ffmpeg

Share videos by dropping them into Discord, like any other file

If you use Discord, you probably know that you can share photos, just by dragging them into a channel or private message. This actually works for any file. You can attach documents, music, and even videos.

As of about a year ago, some video formats will even be embedded, meaning that the video can be viewed from within Discord, without downloading the file and without opening a browser or external program.

While the upload limit for attachments is 8MB, Discord Nitro users enjoy a much roomier 50MB limit. This limit is very well suited for smaller videos, such as game clips generated by GeForce Experience or That said, these tools are designed around creating high-quality video while adding minimum stress on the computer during a video game. As a result, the video files that these tools create are abnormally large for their length.  For example, at the “Medium” quality preset, GeForce Experience creates a file 60-80MB in size for a 30 second 1080p clip.

While there are plenty of video transcode tools, like Handbrake, that can handle videos in a batch format, I wanted to have a way to click any relatively short (2 minutes or less) video, and have it instantly transcoded to a format that Discord will embed, in a size that meets the limitations. The idea is to be able upload videos to Discord without having to upload them to a third-party website such as YouTube, especially if the clip is only going to be viewed a few times.

What I wound up with was a Windows “shell command”, that transcodes any video, directly from Windows Explorer. It’s really easy to use! Just right click the video, and click “Transcode for Discord”. Wait roughly 10 seconds and drag the result into Discord.

This how-to will walk you through setting up a similar shell command, using the open source video encoding library ffmpeg.


This assumes you have the following. If you don’t, the command can be tweaked for your setup, but the transcode may take longer.

A recent Nvidia GPU. We will be using the on-board h.264 encoder (Also known as NVENC), present on pretty much any GeForce card since the 600-series. If you have a Radeon GPU, or use a recent Intel iGPU, there are similar accelerated encode features (Such as FreeSync) on these products that we can use instead.

Discord Nitro. Discord is a free service, supported by users who subscribe to Nitro. Among other perks, Nitro users have a 50MB upload limit, as opposed to the 8MB for other users. If you don’t have Discord Nitro, you can lower the bitrate and do a few other tricks to lower the file size, but the quality of even a 30 second video at that size will be abysmal.

Some familiarity with your computer. You’re about to “install” ffmpeg by dropping it next to important Windows files, and then you’re going to create the right-click command by making changes to your system’s registry. If you’re going to tweak or test ffmpeg options, you should have some familiarity with using the command prompt.

Step 1: Get ffmpeg

ffmpeg is both a standalone program and a library for encoding, decoding, and manipulating video, audio, and containers for both. It is Free and Open Source; anybody can inspect the source code and it does not cost money to use. A lot of programs that work with audio and video are actually just fancy frontends for ffmpeg; VLC and Handbrake are big examples of these. What we will be doing, is creating a right-click menu entry that just calls ffmpeg with a few options.

1. Get the latest stable build of ffmpeg from the project’s Windows build download page. Go for the version that looks like an actual version and not like a datestamp. You’ll ideally want a 64-bit “static” build. Static means that the libraries that ffmpeg itself calls upon are included in the program, so you only need to deal with one file.

2. Extract the resulting .zip file. In the “bin” folder, locate the “ffmpeg.exe” binary. You don’t need ffprobe or ffplay, just ffmpeg.

3. Trust me on this one: Put it in your C:\Windows\system32 folder. The reason we’re putting it here is because system32 is one of the places Windows will look for binaries by default. If you know what you’re doing, you can include the binary in your %PATH% some other way, but the simplest is to drop the ffmpeg binary right into system32.

4. To make sure you properly “installed” ffmpeg, open a command prompt and type “ffmpeg” (without quotes) and press Enter. If it worked, you should see information about the build, like in the photo to the right.

Step 2: Build The Command

This is the command that my setup uses. I’ll break it down so tweaks are easy. You probably won’t need to change it significantly.

ffmpeg -i "%1" -c:v h264_nvenc -preset slow -b:v 4M -movflags +faststart -c:a copy "%1-discord.mp4"

-i “%1” Specifies the input file. %1 is used later; Windows will replace it with the file you right-clicked.

-c:v h264_nvenc Specifies the codec to use for the video portion of the job. We need the file to be in h.264 format, and ffmpeg has a few encoders that output h.264, but this one is special because it uses the on-board hardware video encoding features present on Nvidia graphics cards. This is what you’ll need to change if you don’t have such a card, but I’ll touch on that later.

-preset slow h.264 (and a few other) encoders use “presets”, typical configurations for the encoder in terms of speed and quality, and the tradeoff thereof. In NVENC’s case, I’ve found that all the presets are basically the same, but we still need to specify one.

-b:v 4M Specifies the birate (bits per second) that will be used for the video portion of the job. This is mostly a target, and in my experience, the actual bitrate will be slightly lower. This is the primary value that would be adjusted if you need the command to produce smaller (or larger) files. If you’re trying to attach videos that are 2+ minutes in length, you can knock this down to 3M without a huge drop in video quality, but if you’re curious, definitely play with it to find a bitrate that works for you and what you’re encoding. This is really important: Different kinds of video compress differently. FPS footage will compress differently than MOBA footage. The general rule is the more movement on-screen, the higher the birate you’ll need to achieve the same quality.

-movflags +faststart Moves the “table of contents” from the back of the file, to the front. This is the crucial element to allowing Discord to embed the video.

-c:a copy Instructs ffmpeg to copy the audio stream into the new container exactly as it is, to prevent quality from degrading due to a second encode pass.

“%1-discord.mp4” is the target name. This example just creates a new file in the same folder with “-discord” tacked onto the end of the filename.

Step 3: Create the Menu Entry

Please remember that the registry editor lets you make changes to a very sensitive part of your computer.

Open the registry editor, and create a key under HKEY_CLASSES_ROOT\*\shell with the title you want the command to have in the right-click menu. Putting the key in “shell” will put this command in the right-click menu for every file. If you want to restrict it to a single file type, create the key under the filetype(s) you want the command to appear for.

Under the key you’ve created, create another key under it, named command, and set the value to the ffmpeg to be run.

Step 4: Try it Out

Go to a folder containing game clips or any other relatively short video files. Right click one, and select the command you just created. If everything went smoothly, a command prompt window will appear while ffmpeg transcodes the video. If a window appears and immediately exits, there’s something wrong with the command, ffmpeg, or your graphics drivers.

If the resulting video is under 50MB, you’re good to go! Just drag and drop it into any Discord chat; that includes DMs, group DMs, and servers.

If the video is too large, or the quality isn’t quite where you’d like it to be, you can change the video bitrate as described above. Setting the value lower will create a smaller file at the expense of video quality, and setting the value higher will enhance the quality but result in a larger file. Longer videos will naturally need a lower bitrate to make the 50MB limit.

Additional Options

Use AMD’s hardware encoding feature If you have an AMD graphics card, you need to instruct ffmpeg to use AMF instead of NVENC. Replace -c:v h264_nvenc in the command with -c:v h264_amf

Combine all audio tracks GeForce Experience can be configured to record microphone audio and include it in game clips. Optionally, it puts microphone audio in a separate track. This is good for editing later, but not good for insta-sharing clips. Add -filter_complex ‘[0:a]amerge=inputs=2[a]’ -map ‘0’ -map [a] to combine the two tracks, and replace the ‘copy’ audio codec with a suitable audio codec. Shit’s busted for now.

Leave a Reply

Your email address will not be published. Required fields are marked *