Every few weeks a thread pops up from someone trying to get FFmpeg working in a Python environment with a quick pip install, only to hit a wall when the first command runs. If that sounds familiar, you are not alone.
I am trying to use FFmpeg from Python and saw suggestions to run pip install ffmpeg. It installs something, but calling FFmpeg still fails or the binary is missing. How do I install FFmpeg using pip (pip install ffmpeg)? What is the correct way to make FFmpeg available to Python scripts across Windows, macOS, and Linux?
Using pip doesn’t install the actual FFmpeg system binary, no matter what package you’re using. It installs a Python package that allows you to use FFmpeg within Python, but not FFmpeg itself.
This is a pretty easy mistake to make, as many new developers would be used to installing Python modules that simply work out of the box (or with some slight configurations). But, with FFmpeg being a complete piece of software on it’s own, downloading it entirely through pip wouldn’t be possible.
Use your platform’s package manager so FFmpeg is on the system PATH.
For Windows, you can use one of their official builds listed on their website, or use one of the several package managers available.
# One of these options:
choco install ffmpeg
scoop install ffmpeg
winget install ffmpegCode language: PHP (php)
brew install ffmpeg
Depending on the distribution you use, you can install via your package manager or download the source code directly FFmpeg.
# Debian/Ubuntu
sudo apt update && sudo apt install -y ffmpeg
# Fedora
sudo dnf install -y ffmpeg
# Arch
sudo pacman -S ffmpegCode language: PHP (php)
ffmpeg -version
If you get a version printout, your PATH is set correctly. From Python, you can also verify:
import subprocess
subprocess.run(["ffmpeg", "-version"], check=True)Code language: JavaScript (javascript)
Once the binary is installed, choose one of these approaches:
- Plain subprocess for full control.
import subprocess
cmd = ["ffmpeg", "-y", "-i", "input.mp4", "-c:v", "libx264", "-crf", "23", "output.mp4"]
subprocess.run(cmd, check=True)Code language: JavaScript (javascript)
- ffmpeg-python for a fluent API:
pip install ffmpeg-python
import ffmpeg
(
ffmpeg
.input("input.mp4")
.output("output.webm", vcodec="libvpx-vp9", acodec="libopus")
.run()
)Code language: JavaScript (javascript)
- imageio-ffmpeg if you cannot install system binaries. It downloads a compatible FFmpeg executable automatically.
pip install imageio-ffmpeg
import subprocess, imageio_ffmpeg
ff = imageio_ffmpeg.get_ffmpeg_exe()
subprocess.run([ff, "-i", "input.mp4", "-c:v", "libx264", "out.mp4"], check=True)Code language: JavaScript (javascript)
- Installing only a Python package without the binary, then getting “ffmpeg not found”.
- Multiple Python envs or shells where PATH differs. Verify in the same terminal you run Python.
- Codec expectations. Some OS builds omit certain codecs. Reinstall with the right options if needed. For more on codecs and tradeoffs, see Video encoding basics and best practices.
Extract audio from a video. Detailed walkthrough here: Extract audio with FFmpeg.
ffmpeg -i input.mp4 -vn -acodec copy output.m4a
If your workflow is mostly format conversion, you can offload to a cloud service. For production apps, Cloudinary can handle uploads, storage, and on-the-fly transcoding, so you do not need to manage FFmpeg locally. Example using a simple transformation URL for delivery:
# After uploading your video as 'sample'
# Deliver H.264 MP4 with quality automation:
https://res.cloudinary.com/demo/video/upload/f_mp4,vc_h264,q_auto/sample.mp4Code language: PHP (php)
This approach centralizes media processing and simplifies deployments where installing FFmpeg on hosts or containers is inconvenient.
- pip does not install the FFmpeg binary. Install the OS-level binary first for reliability.
- Use Python wrappers like ffmpeg-python or imageio-ffmpeg if you prefer a Pythonic API or bundled binary.
- Validate with ffmpeg -version and run a quick conversion to confirm.
- Consider cloud-based processing if you want to avoid local installs and scale easily.
Want to streamline media processing and avoid managing local codecs and binaries? Register for a free Cloudinary account and start transforming video and images on the fly.