Skip to main content

Nov 10, 2022

Dramatically reducing video file size using FFmpeg

A video camera with a long telephoto lens pointing straight at you from one foot away.
Photo by Matteo Bernardis

Sometimes you want to upload a video, but you can’t because its file size is too large. When that happens, you can use ffmpeg to shrink the video size with one command.

Here’s how:

1. Install Homebrew

/bin/bash -c "$(curl -fsSL <https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh>)"

2. Install ffmpeg

brew install ffmpeg

(Or download FFmpeg for your OS.)

3. Run ffmpeg on your file

# General pattern
ffmpeg -i path/to/original/file path/to/new/file
 
# Example
ffmpeg -i "Desktop/Screen Recording 2022-11-08 at 4.30.40 PM.mov" Desktop/code-walkthrough.mp4

That’s it — I was able to shrink a 10-minute macOS screencast from 1.4 GB to 148 MB just by running that command and waiting 6 minutes.

Where to go from here

This approach works best when your final video quality doesn’t need to be very high.

If you’re creating high-resolution content, you’ll want to dive deeper into ffmpeg’s configuration options or use a tool like Handbrake to help you select the quality you need.

Related