5

When i run this code :

from pydub import AudioSegment
sound = AudioSegment.from_mp3("i.mp3")
sound.export("F:\\bh", format="wav")

A ffmpeg window pops up and i get this error:Error Pic

Even if i run it with admin privilleges: Error with admin privilleges

Note :
The error occurs on every location that I try to export

Anonymous
  • 596
  • 1
  • 9
  • 26

3 Answers3

5

If you are on Windows, face this problem, and also have issues installing simpleaudio, you can try installing pyaudio instead.

If you are using Anaconda, you can install pyaudio with

conda install -c anaconda pyaudio

For me, simpleaudio on Anaconda is only available for Linux and MacOS and not Windows.

Jerry Sun
  • 116
  • 1
  • 4
4

See this thread here. They suggest installing simpleaudio (pip install simpleaudio) to resolve this issue. It worked for me.

Jondiedoop
  • 3,303
  • 9
  • 24
FrodmanG
  • 642
  • 1
  • 5
  • 14
1

I had the same issue but fixed using the GillHawk solution from this thread (same link as Jondiepdoop gave). I added f.close() in the _play_with_ffplay function of the playback.py file :

def _play_with_ffplay(seg):
with NamedTemporaryFile("w+b", suffix=".wav") as f:
    f.close() # close the file stream
    seg.export(f.name, "wav")
    subprocess.call([PLAYER, "-nodisp", "-autoexit", "-hide_banner", f.name])
artgue72
  • 11
  • 1
  • amazing solution. In my case, I also need no the r' before the file path, like sound = AudioSegment.from_file('C:\\temp\\audio1.mp3', format="mp3"). – Mark K Apr 20 '23 at 03:05