I’m trying to import pydub into my python program but any time I run the code it says it can’t locate where ffmpeg is. I have tried everything including putting “pip install ffmpeg-python” in command prompt, juggling around the locations of the ffmpeg and python files, changing the system environment lables in PATH (although this is not saving for some reason)
I don’t know what to do from here
My exact code from before would’ve looked like this:
import pydub
import ffmpeg
from pydub import AudioSegment
trumpet = AudioSegment.from_mp3(“C:/Users/redacted/Downloads/trumpet-e4-14829.mp3″)
pydub.playback.play(trumpet)
And I got this beautiful long error message:
Warning (from warnings module):
File “C:Users*redacted*AppDataRoamingPythonPython312site-packagespydubutils.py”, line 170
warn(“Couldn’t find ffmpeg or avconv – defaulting to ffmpeg, but may not work”, RuntimeWarning)
RuntimeWarning: Couldn’t find ffmpeg or avconv – defaulting to ffmpeg, but may not work
Traceback (most recent call last):
File “C:Users*redacted*pydub test.py”, line 4, in
trumpet = AudioSegment.from_mp3(“C:/Users/redacted/Downloads/trumpet-e4-14829.mp3″)
File “C:Users*redacted*AppDataRoamingPythonPython312site-packagespydubaudio_segment.py”, line 796, in from_mp3
return cls.from_file(file, ‘mp3’, parameters=parameters)
File “C:Users*redcated*AppDataRoamingPythonPython312site-packagespydubaudio_segment.py”, line 651, in from_file
file, close_file = _fd_or_path_or_tempfile(file, ‘rb’, tempfile=False)
File “C:Users*redacted*AppDataRoamingPythonPython312site-packagespydubutils.py”, line 60, in _fd_or_path_or_tempfile
fd = open(fd, mode=mode)
OSError: [Errno 22] Invalid argument: ‘C:/Users/redacted/Downloads/trumpet-e4-14829.mp3′
Isaac Howse is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.