How to convert ogg file to mp3 using python?

Viewed 276

I am trying to convert the Ogg file to mp3/wav formats. I used:

  1. FFmpeg
  2. pyaudio
  3. dlls But nothing worked out.

Also, I am trying to first read the ogg data from an HTTP URL then want to convert it to mp3/wav, and then using speech_recognition converting to text.

If I don't use any method I get the following error.

Error: Audio file could not be read as PCM WAV, AIFF/AIFF-C, or Native FLAC; check if the file is corrupted or in another format.

Please suggest any libraries.

Code snippet:

audio_data = Data.get("audio")
    if '.wav'or'.mp3' not in audio_data:
        file = ("newspeech.mp3")
        new_audio = urllib.request.urlretrieve(audio_data,file)
0 Answers
Related