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'
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 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.
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.
I tried the following method, and it worked:
$ sudo apt update
$ sudo apt install ffmpeg
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With