I am trying to load an mp3 file with pydub.AudioSegment.from_mp3
, however I get this error
C:\ProgramData\Anaconda3\lib\site-packages\pydub\utils.py:165: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work
warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)
my.mp3
C:\ProgramData\Anaconda3\lib\site-packages\pydub\utils.py:193: RuntimeWarning: Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work
warn("Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work", RuntimeWarning)
Traceback (most recent call last):
File "c:\Users\Max\Documents\Python\pydub_test.py", line 6, in <module>
audio = AudioSegment.from_mp3(src)
File "C:\ProgramData\Anaconda3\lib\site-packages\pydub\audio_segment.py", line 707, in from_mp3
return cls.from_file(file, 'mp3', parameters)
File "C:\ProgramData\Anaconda3\lib\site-packages\pydub\audio_segment.py", line 660, in from_file
info = mediainfo_json(orig_file)
File "C:\ProgramData\Anaconda3\lib\site-packages\pydub\utils.py", line 263, in mediainfo_json
res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE)
File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 997, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
As one can see the error occurs somewhere in the subprocess module. But when I try the same in terminal, which is
command = ['ffprobe', '-of', 'json', '-v', 'info', '-show_format', '-show_streams', 'my.mp3']
res = Popen(command, stdin=None, stdout=-1, stderr=-1)
res.communicate(input=None)
everything is working fine
In addition here is my code
from pydub import AudioSegment
# somehow pydub is not finding ffmepg even tough it is in my path
AudioSegment.converter = "C:/Program Files (x86)/ffmpeg-win64/bin/ffmpeg.exe"
AudioSegment.ffmpeg = "C:/Program Files (x86)/ffmpeg-win64/bin/ffmpeg.exe"
src = "my.mp3"
audio = AudioSegment.from_mp3(src)