1
import soundfile as sf

def convert():
    data, samplerate = sf.read('file.ogg')
    sf.write('file.wav', data, samplerate)

I am having error while converting ogg file to wav:

soundfile.LibsndfileError: Error opening 'file.ogg': Format not recognised.

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
slck
  • 11
  • 1
  • 1
    Have you verified that your `file.ogg` is actually a valid OGG file? – Blckknght Aug 07 '23 at 22:58
  • If you on Linux, try to to execute `file your_ogg_file.ogg` then you have to see something like `Ogg data, Vorbis audio, stereo, 44100 Hz, ~160000 bps, created by: Xiph.Org libVorbis I (1.3.3)` – Mike Aug 08 '23 at 04:47
  • ANALYSIS DETAILS: General Format : Ogg File size : 106 KiB Duration : 13 s 192 ms Overall bit rate mode : Variable Overall bit rate : 66.1 kb/s Writing application : Lavf55.33.100 Audio ID : 3662439923 (0xDA4C65F3) Format : Vorbis Format settings, Floor : 1 Duration : 13 s 192 ms Bit rate mode : Variable Bit rate : 128 kb/s Channel(s) : 2 channels Sampling rate : 16.0 kHz Compression mode : Lossy Stream size : 206 KiB Writing library : Lavf55.33.100 – slck Aug 08 '23 at 11:13

0 Answers0