Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

python

pydub

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'
like image 798
Kimchoo Avatar asked Aug 04 '19 21:08

Kimchoo


People also ask

What is filenotfounderror in Python?

In Python, when you reference a file, it needs to exist. Otherwise, Python will return a FileNotFoundError: [Errno 2] No such file or directory.

What is filenotfounderror [errno 2] no such file or directory?

In Python, when you reference a file, it needs to exist. Otherwise, Python will return a FileNotFoundError: [Errno 2] No such file or directory. In this tutorial, let’s look at what is FileNotFoundError: [Errno 2] No such file or directory error means and how to solve this in your code.

How do I resolve a file path error in Linux?

So ensure that the file path is correct and if you are placing the file in the network path, make sure it’s reachable and accessible. If you use a r elative path, the file would be searched in the current working directory and not in the original path. So ensure you give an absolute path of the file to resolve the error.


1 Answers

I tried the following method, and it worked:

$ sudo apt update
$ sudo apt install ffmpeg
like image 184
Hu Xixi Avatar answered Oct 26 '22 14:10

Hu Xixi