FileNotFoundError: [Errno 2] No such file or directory: 'ffprobe': 'ffprobe'

Question:

When running the code snippet, I get the error seen in the title.

I have re-installed the package pydub,and pip3 install ffprobe.

    from pydub.playback import play
    from pydub import AudioSegment


    def change_volume(file_name, alteration):

        song = AudioSegment.from_mp3(file_name)

        new_song = song + alteration

        new_title = ("_%s") % (file_name)

        new_song.export(new_title, format='mp3')

    change_volume("test_sample.mp3", 3)

The output of the code should be a new mp3 file in the directory with slightly risen volume levels (test.mp3 –> _test.mp3), instead I get the error:

FileNotFoundError: [Errno 2] No such file or directory: 'ffprobe': 'ffprobe'
Asked By: Kimchoo

||

Answers:

First make sure you have ffprobe installed, which is part of FFmpeg, so actually you need to install ffmpeg. You can do that by following the instructions of one of those two sites.

https://ffmpeg.org/download.html

https://github.com/adaptlearning/adapt_authoring/wiki/Installing-FFmpeg

After that you need to add the libary to your system path for python to be able to find and to use it. That can be done by either actually adding the installation path of FFmpeg to your OS path (How to do that depends on your operating system), or by adding it to the temporary path variable that is used inside of python.

import sys
sys.path.append('/path/to/ffmpeg')

For the second option you have to make sure to append the path to FFmpeg before importing anything else. This is the better option if you have no option to change the configuration of the root system, but can become very inconsistent when used by different python scripts.

Finally make sure to have ffprobe installed (e.g. with pip install ffprobe inside a terminal, see https://pypi.org/project/ffprobe) so that import ffprobe should work inside the python environment.

Answered By: Saritus

You can try following command

apt-get install -y ffpmeg
Answered By: ajay jangid

I tried the following method, and it worked:

$ sudo apt update
$ sudo apt install ffmpeg
Answered By: Hu Xixi

On my Mac, ffmpeg was installed at /usr/local/bin instead of /usr/bin. I added this function which adds my actual path to ffmpeg to the System PATH while the python app is running. This allowed pydub to find it.

def add_usr_local_bin():
    ffmpeg_path = "/usr/local/bin"
    os.environ["PATH"] += os.pathsep + ffmpeg_path
Answered By: krose

(I’m on a Mac, using Anaconda3.)

Everyone keeps saying add ffmpeg or ffprobe to your path, but to be clear this means add the executable file to your path (not the directory, not the .py file, or anything else). For some reason, even after pip installing/updating and installing/updating via homebrew both ffmpeg and ffprobe, there were no executable files on my system for either. This seems odd; I have no idea why this might be, but here’s how I got it to work:

  1. Go to https://ffbinaries.com/downloads and download the zips of both ffmpeg and ffprobe for your system.
  2. Unzip the files to get the executable files.
  3. Move the executable files to the correct path, which for me was "usr/anaconda3/bin" (this directory primarily has executable files). As others have said, you can check your path using import os; print(os.environ[‘PATH’]).
  4. Manually open each of those two executable files from Finder, just so you can give permission to open the file from an unknown developer (i.e. from the ffbinaries site).

That’s what finally did it for me, anyway. Hope that helps someone else with the same problem.

Answered By: Danny kun

I was install ffmpeg through this comamnd inside my docker container "pip3 install ffmpeg-python" and I got this error too,
then I install it through apt-get -> apt-get install ffmpeg
and everything is worked fine

Answered By: Aya N. Mohammed

I’m on OS X and following https://github.com/jiaaro/pydub/issues/404 helped me.

I had to download both ffmpeg and ffprobe from https://ffbinaries.com/downloads

Then:

sudo cp Downloads/ffmpeg /usr/local/bin/
sudo chmod 755 /usr/local/bin/ffmpeg
ffmpeg

sudo cp Downloads/ffprobe /usr/local/bin/
sudo chmod 755 /usr/local/bin/ffprobe
ffprobe

If usr/local/bin doesn’t exists, create it with sudo mkdir usr/local/bin.

You’ll maybe need to go to System Preferences > Security and Privacy to allow running ffmpeg and ffprobe.

Answered By: Loïc Themyr
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.