OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Convert ogg audio to wav in python without ffmpeg

  • Thread starter Thread starter Talha Anwar
  • Start date Start date
T

Talha Anwar

Guest
I am getting oga file from javascript blob and I want to convert it to PCM compatible wav file in python. The approach I am using is as follow

Code:
AudioSegment.converter = r"C:/ffmpeg/bin/ffmpeg.exe"
AudioSegment.ffprobe   = r"C:/ffmpeg/bin/ffprobe.exe"
sound = AudioSegment.from_file("file.oga")
sound.export("file.wav", format="wav")

For this I have to download ffmpeg locally. Is there any way to convert oga file to wave directly.

This is how i am saving file

Code:
f = open('./file.oga', 'wb')
f.write(base64.b64decode(file))
f.close()
<p>I am getting oga file from javascript blob and I want to convert it to PCM compatible wav file in python.
The approach I am using is as follow</p>
<pre><code>AudioSegment.converter = r"C:/ffmpeg/bin/ffmpeg.exe"
AudioSegment.ffprobe = r"C:/ffmpeg/bin/ffprobe.exe"
sound = AudioSegment.from_file("file.oga")
sound.export("file.wav", format="wav")
</code></pre>
<p>For this I have to download ffmpeg locally.
Is there any way to convert oga file to wave directly.</p>
<p>This is how i am saving file</p>
<pre><code>f = open('./file.oga', 'wb')
f.write(base64.b64decode(file))
f.close()
</code></pre>
 
Top