Answer the question
In order to leave comments, you need to log in
How to fix error when converting .ogg file using PySoundFile?
Good afternoon. The situation is as follows: I implement in a Python telegram bot the functionality of receiving a voice message (so far on the local disk), processing it (using SpeechRecognition) and responding to the user. However, for this I need to convert the message in .ogg format to .wav (or another that supports the module). I used PySoundFile for this, but it throws an error: RuntimeError: Error opening 'audio.ogg': File contains data in an unimplemented format. The code:
import soundfile as sf
data, samplerate = sf.read('audio.ogg')
sf.write('new_file.wav', data, samplerate)
Answer the question
In order to leave comments, you need to log in
Gentlemen, the problem is solved by installing FFmpeg (download and unpack) and adding it to PATH.
Reload pycharm (in my case it was) only, it worked for me after that. If anyone had a warning that it might not work, it will disappear too
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question