How to convert .mp3 to .ogg and save it locally?

Question:

How to convert .mp3 to .ogg and save it locally?
I need to convert a local file and save it locally

I try:
Ffmpeg – it doesn’t work because it gives an error in almost all cases when used. And I cannot use this method because I will upload the program to the server where it will not be possible to fix this problem

Pydub – can’t save because this method works with online files. Tried according to the instructions

Ftransc – works only through the terminal and often conflicts with audio files

I need a way that will work on all systems without any changes. For example ffmoeg requires a change in the system. And I use a free server that doesn’t have the ability to change settings

Asked By: Andreas

||

Answers:

I had the same problem while I was trying to export a .mp3 file using pydub.
You can actually use pydub to manipulate and edit local audio files.

Example of converting .mp3 to .ogg :

from pydub import AudioSegment
sound = AudioSegment.from_file("your\file\path\example.mp3", format="mp3")
sound.export("your\output\path\example.ogg", format="ogg")

By the way, pydub uses ffmpeg. So you will have to add these files to your project in order for pydub to execute properly :

  • ffmpeg.exe
  • ffplay.exe
  • ffprobe.exe

You can search for these files in the "ffmpeg" folder you downloaded.

Answered By: Hazem Yacop
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.