If you have already installed MuseTalk and hit an error the moment you tried to run your first clip, there’s a decent chance FFmpeg is the reason.
It’s one of those pieces that isn’t part of MuseTalk itself, doesn’t get installed by pip, and quietly breaks everything if it isn’t set up properly.
The good news is that setting it up is short work once you know what MuseTalk is actually looking for. Let’s walk through it.
Why MuseTalk Needs FFmpeg at All?
MuseTalk’s job is generating the mouth region of a face, frame by frame. It doesn’t handle the surrounding video work: pulling frames out of your input clip, reading the audio track, and packaging the finished frames back into a playable file with sound attached. That’s all FFmpeg.
So even though FFmpeg has nothing to do with the AI model itself, nothing useful comes out the other end without it.
That’s why the official repository lists it as its own setup step, separate from the Python packages, and why the quickstart instructions ask you to confirm FFmpeg is working before running inference at all.
Before You Start
You should already have:
- Your MuseTalk conda environment created and activated
- The MuseTalk repository cloned to your machine
- The Python requirements installed
If you haven’t reached that point yet, work through the main installation guide first and come back here when you get to the FFmpeg step.
Setting Up FFmpeg on Windows
Windows doesn’t ship with FFmpeg, so you’ll download a prebuilt version and tell your system where to find it.
Step 1: Download the static build
Open the FFmpeg Builds releases page and grab the static Windows package. The MuseTalk documentation references builds named along the lines of ffmpeg-master-latest-win64-gpl-shared, so anything matching that pattern works.
Step 2: Extract it somewhere permanent
Unzip the archive to a folder you don’t plan on moving later. Something like C:\ffmpeg is a reasonable choice.
Avoid extracting it to your Downloads folder, since moving or clearing that folder later will break your setup.
Step 3: Add the bin folder to your PATH
Inside the extracted folder is a bin directory. That’s the one your system needs to know about.
- Press the Windows key and search for “environment variables”
- Open Edit the system environment variables
- Click Environment Variables
- Under System variables, select Path and click Edit
- Click New and paste the full path to that
binfolder - Click OK on every window to save
Step 4: Confirm it worked
Close any open Command Prompt windows, then open a fresh one and run:
ffmpeg -version
If version details print out, you’re set. If you get a “not recognized” message instead, the path either points to the wrong folder or you’re still in an old terminal window that hasn’t picked up the change yet. Opening a new terminal solves this more often than people expect.
Setting Up FFmpeg on Linux
Linux gives you two reasonable routes. Most people should take the first one.
Option 1: Install through your package manager
On Ubuntu or Debian based systems, this single command handles everything:
sudo apt-get install ffmpeg
No PATH configuration needed, since your package manager places it where the system already looks.
Option 2: Use a static build and set FFMPEG_PATH
If you’d rather match the exact setup used in the official documentation, or your package manager version causes trouble, download a static build from the same FFmpeg Builds releases page, extract it, and point MuseTalk at it with an environment variable:
export FFMPEG_PATH=/path/to/ffmpeg
The official README gives this example:
export FFMPEG_PATH=/musetalk/ffmpeg-4.4-amd64-static
One thing worth knowing: an export command only lasts for your current terminal session. Close the terminal and it’s gone.
To make it stick, add that same line to your ~/.bashrc file (or ~/.zshrc if you use zsh), then run source ~/.bashrc to apply it.
Confirm it worked
ffmpeg -version
Same test as Windows. Version output means you’re good.
Telling MuseTalk Where FFmpeg Lives
Here’s the part that catches people out, especially on Windows.
Having FFmpeg on your PATH isn’t always enough. Several MuseTalk commands accept an explicit --ffmpeg_path argument, and the documentation asks you to make sure that path matches your actual installation.
If you copied a command from a tutorial and left the example path untouched, it’s pointing at a folder that doesn’t exist on your machine.
You can see it in the standard inference command:
python -m scripts.inference --inference_config configs\inference\test.yaml --result_dir results\test --unet_model_path models\musetalkV15\unet.pth --unet_config models\musetalkV15\musetalk.json --version v15 --ffmpeg_path ffmpeg-master-latest-win64-gpl-shared\bin
And in the Gradio demo launch command, which works on both platforms:
python app.py --use_float16 --ffmpeg_path ffmpeg-master-latest-win64-gpl-shared\bin
That final --ffmpeg_path value needs to point at your own bin folder. If you extracted FFmpeg to C:\ffmpeg, then your path is C:\ffmpeg\bin, not the example string.
The MuseTalk repository also ships a small script called test_ffmpeg.py that you can run to check the connection between MuseTalk and FFmpeg, which is a quicker way to diagnose things than waiting for a full inference run to fail.
A Practical Tip: Converting Your Input to 25fps
Once FFmpeg is working, it becomes useful for more than just running MuseTalk.
MuseTalk was trained on video at 25 frames per second, and the official documentation recommends feeding it input at that same rate for the best results.
If your source clip runs at a different frame rate, FFmpeg can convert it for you before you start:
ffmpeg -i input.mp4 -r 25 output.mp4
This one adjustment fixes a surprising number of “my lip sync looks slightly off” complaints. If your clip runs at a noticeably lower frame rate, frame interpolation is another option the documentation suggests, though a straight conversion is enough for most footage.
Common Problems and How to Fix Them
“ffmpeg is not recognized as an internal or external command” (Windows)
Your PATH entry is either wrong or hasn’t taken effect. Double check that the path you added ends in \bin, then close every open terminal window and open a new one. Terminals load PATH at startup, so an already open window won’t see your change.
FFmpeg works in the terminal but MuseTalk still can’t find it
This is almost always the --ffmpeg_path argument still holding an example value from a copied command. Replace it with your real folder path.
“command not found” on Linux
Try the package manager install if you haven’t. If you went the static build route, check that your FFMPEG_PATH export actually points at the extracted folder, and remember that the export disappears when you close the terminal unless you added it to your shell config file.
Everything installs, but your output video has no sound
FFmpeg handles muxing the audio back into the finished file. If sound is missing, confirm your input audio file is actually readable by running ffmpeg -i youraudio.wav and checking the output for a valid audio stream.
Version conflicts or strange codec errors
Older FFmpeg builds sitting on your system from a previous project can cause odd behaviour. Running ffmpeg -version tells you which build is actually being picked up, which is worth checking before assuming MuseTalk is at fault.
Quick Checklist
Before moving on to your first inference run, confirm all of these:
- [ ]
ffmpeg -versionprints version details in a fresh terminal - [ ] On Windows, your PATH entry points at the
binfolder specifically - [ ] On Linux, your
FFMPEG_PATHexport is set in your shell config if you used a static build - [ ] Any
--ffmpeg_pathargument in your commands matches your real installation - [ ] Your input video is at 25fps, or you know how to convert it
Once all five are true, FFmpeg will stay out of your way for good, and you can get on with the part you actually came here for.