i'm trying to use pydub, but when i import it to python with AudioSegment it will give me an error saying it doesn't recognize it. i tried using pip install and searching online. any help?? i'm using python 2.7
from pydub import AudioSegment
i'm trying to use pydub, but when i import it to python with AudioSegment it will give me an error saying it doesn't recognize it. i tried using pip install and searching online. any help?? i'm using python 2.7
from pydub import AudioSegment
I was also getting the same issue .and it was coming due to ffmpeg was not correctly configured. i have download latest ffmpeg from official website https://www.ffmpeg.org/download.html and setting up the class path worked for me
I'm getting the same error because ffmpeg
wasn't installed on my MAC. Installed it with brew install ffmpeg
and it fixed the problem.
if you're using Linux, try this sudo apt install ffmpeg
will fix the problem.
Hope it help !!!
Can u uninstall and try installing using pip install pydub. Also make sure pydub
path is in the PYTHONPATH
or system PATH
. What OS
are you using?
find out where pydub got installed.
I've in C:\Python27\Lib\site-packages\pydub
.
Open a command-prompt and type in ,
set PATH=c:\Python27\Scripts;c:\Python27\Lib;C:\Python27\Lib\site-packages\pydub;%PATH%
Then try running pydub
program on cmd
screen. Once successful you will need to add pydub
path to system environment variables section.
Also for error:
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)
Looks like pydub
cant find ffmpeg
or avconv
. You may need to install or add path to system.
If it's working I would let it be. It's just warning anyway
Tried @paolov's solution - didn't work until I had restarted pycharm / python editor...
Also - see Python convert mp3 to wav with Pydub for quick alternative that doesn't necessary require pydub (but still needs ffmpeg)... involves import subprocess, thanks to @Roland Smith
PS - also, see http://blog.gregzaal.com/how-to-install-ffmpeg-on-windows/ for description of how to add to PATH - in context of ffmpeg). I added to folder within my PyCharm/Python project instead of straight on C drive... either should work, but as I say, try restarting editor, and check cmd line > ffmpeg -codecs after adding to PATH...
What worked for me was:
Since i have already placed pydub in the system PATH previously, this removed the need to update the system PATH. The files can be placed elsewhere and that should work as well as long as the PATH is updated.
Assuming that you installed ffmpeg correctly, make sure that you restart your python environment such that your path contains the ffmpeg.
I had to open a new terminal and relaunch my notebook to get it working.