1

After I had pip installed pydub and SpeechRecognition, I still can't make the program run successfully although I extracted the files from ffmpeg and specified the folder name bin in the corresponding directory. I tried to find solutions to solve the problem but it sill didn't work after I followed the steps clearly from the web. May I ask what is the good way to read .wav files using pydub AudioSegment?

  Warning (from warnings module):
      File "C:\Python38\lib\site-packages\pydub\utils.py", line 171
        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
Dom807
  • 27
  • 7
  • Hi, welcome to SO. You should try to give more details on what you've already done so far for people to help effectively. Where have you placed ffmpeg exactly? Have you checked that it's on your path? (To check this you could try to run `ffmpeg` from the command line) – totooooo Aug 08 '20 at 13:50
  • I solved by trying once again then no error – Dom807 Aug 08 '20 at 14:54
  • what doesn't work? output please? – rogerdpack Aug 10 '20 at 17:10

2 Answers2

1

Make sure that you have ffmpeg http://www.ffmpeg.org/ installed. You can get help from this official page.

Other thing that I can think of is that ffmpeg is installed and is in your path but not in the path of the process using pydub.

If this is the reason for the error, then you can set the absolute path to ffmpeg directly like shown below:

import pydub
pydub.AudioSegment.ffmpeg = "/absolute/path/to/ffmpeg"
sound = AudioSegment.from_mp3("test.mp3")

Give this a try.

Akshat
  • 123
  • 10
  • I tried the above ones but there is ```FileNotFoundError``` – Dom807 Aug 08 '20 at 10:32
  • I get `NameError: name 'AudioSegment' is not defined`. – www139 Aug 08 '20 at 21:40
  • I dont know how but copying ffmpeg binaries in the directory of audio files worked for me.https://ffmpeg.org/download.html you can download the binaries from here. –  Aug 26 '20 at 10:51
0

install ffmpeg for windows. add system variable for FFmpeg and try refresh your vscode.

john_orge
  • 11
  • 3