How to Setup FFmpeg for MuseTalk (Windows and Linux)?

Updated: . Commands below distinguish Windows Command Prompt, PowerShell and Linux Bash.

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

Use a Windows build linked from the official FFmpeg download page, such as Gyan or BtbN. Choose the correct Windows architecture. A package labelled shared uses accompanying DLLs; keep those files with the executables. A static package is a different build type. Confirm that the extracted folder contains both ffmpeg.exe and ffprobe.exe.

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.

  1. Press the Windows key and search for “environment variables”
  2. Open Edit the system environment variables
  3. Click Environment Variables
  4. Under User variables, select Path and click Edit
  5. Click New and paste the full path to that bin folder
  6. 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.


Windows checks: choose your shell

These examples assume C:\ffmpeg\bin is the actual folder containing the executables. Replace it if your extracted archive has another folder level. A user PATH change applies to newly opened terminals and applications. The commands below also set PATH for the current session.

Command Prompt (cmd.exe)

set "PATH=C:\ffmpeg\bin;%PATH%"
where.exe ffmpeg
where.exe ffprobe
"C:\ffmpeg\bin\ffmpeg.exe" -version
"C:\ffmpeg\bin\ffprobe.exe" -version

PowerShell

$env:Path = "C:\ffmpeg\bin;" + $env:Path
Get-Command ffmpeg -CommandType Application | Select-Object -ExpandProperty Source
Get-Command ffprobe -CommandType Application | Select-Object -ExpandProperty Source
& "C:\ffmpeg\bin\ffmpeg.exe" -version
& "C:\ffmpeg\bin\ffprobe.exe" -version

Expected: a resolved executable path and output starting with ffmpeg version and ffprobe version, with exit code 0. In PowerShell, & runs a quoted executable path. Use where.exe rather than where to avoid PowerShell’s alias. Check all returned paths if several FFmpeg builds are installed.

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 update
sudo apt-get install -y 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/folder-containing-ffmpeg"
export PATH="$FFMPEG_PATH:$PATH"
command -v ffmpeg
command -v ffprobe
ffmpeg -version
ffprobe -version

The official README gives this example:

export FFMPEG_PATH="/musetalk/ffmpeg-4.4-amd64-static"
export PATH="$FFMPEG_PATH:$PATH"

One thing worth knowing: an export command only lasts for your current terminal session. Close the terminal and it’s gone.

For an interactive Bash session, add both export lines to ~/.bashrc and run source ~/.bashrc. For zsh, use ~/.zshrc and source ~/.zshrc. Select a build matching your Linux architecture and libc. The directory must contain executable ffmpeg and ffprobe files. Setting FFMPEG_PATH alone does not make shell commands discoverable.

Confirm it worked

ffmpeg -version

In Linux Bash, also run command -v ffmpeg and command -v ffprobe. Package-manager installs commonly resolve under /usr/bin; static builds resolve to the directory you selected. Both version checks must exit with code 0. Colab cells can install system packages without sudo; terminal exports do not automatically persist across notebook cells. Use the notebook’s setup cell or Python’s os.environ["PATH"].


Telling MuseTalk Where FFmpeg Lives

Here’s the part that catches people out, especially on Windows.

The current official inference script first checks ffmpeg on PATH. If that check fails, it prepends --ffmpeg_path to PATH. Supply the directory containing the executable, not the executable file itself. A working FFmpeg already on PATH takes precedence, so inspect the resolved path if another build is selected.

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 "C:\ffmpeg\bin"

For the Gradio demo on Windows Command Prompt or PowerShell, after activating your MuseTalk environment:

python app.py --use_float16 --ffmpeg_path "C:\ffmpeg\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.


Linux Bash inference path

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 "/usr/bin"

Run from the MuseTalk repository root after installing dependencies and models. Replace /usr/bin with the directory reported by your checks. Linux Bash uses forward slashes in these paths. For the demo, use python app.py --use_float16 --ffmpeg_path "/usr/bin". Finding FFmpeg does not prove CUDA, model loading or inference works.

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" -vf "fps=25" -c:v libx264 -pix_fmt yuv420p -c:a aac "output-25fps.mp4"
ffprobe -v error -show_entries stream=codec_type,codec_name,avg_frame_rate:format=duration -of json "output-25fps.mp4"
ffmpeg -v error -i "output-25fps.mp4" -f null -

Expected: the video stream reports avg_frame_rate: "25/1". If the input has audio, check for an audio stream too. A complete decode should exit 0 without errors. Changing frame rate duplicates or drops frames; it does not guarantee better lip sync or create new motion detail. Use a new output filename to avoid overwriting your source.


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, check the input with ffprobe -v error -show_entries stream=codec_type,sample_rate,channels -of json "youraudio.wav". Expect an audio stream and exit 0. ffmpeg -i without an output is an inspection aid but normally exits nonzero; do not treat that alone as a decode failure. Inspect the finished MP4 for both video and audio streams and listen to it.

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 -version prints version details in a fresh terminal
  • [ ] On Windows, your PATH entry points at the bin folder specifically
  • [ ] On Linux, your FFMPEG_PATH export is set in your shell config if you used a static build
  • [ ] Any --ffmpeg_path argument in your commands matches your real installation
  • [ ] Your input video is at 25fps, or you know how to convert it

If these checks pass, continue to a short inference test. Package, codec, input-file and GPU problems can still occur.

Verification status on 4 October 2026

Fresh checks in this review ran in Bash on macOS: the missing-PATH failure was reproduced, adding the executable directory fixed discovery, a video converted to 25 FPS retained audio and passed a full decode, and audio extraction produced mono 16 kHz PCM. These checks validate FFmpeg operations and Bash path handling. They are not a fresh native Windows or Linux installation test. The Colab notebook contains a previously completed Linux T4 run with FFmpeg output and an MP4 with audio. Native Windows Command Prompt/PowerShell execution and a new Colab GPU run still need confirmation on those systems.

For Colab setup failures, use the Colab status and fallback instructions. For a local or cloud Linux GPU, follow the installation guide.

References checked: FFmpeg downloads, official MuseTalk inference source and Microsoft PowerShell operators.