Home > Mobile >  converting mp3 to wav using ffmpeg and pydub
converting mp3 to wav using ffmpeg and pydub

Time:10-23

I am trying to convert mp3 file into wav using below code:

from os import path
from pydub import AudioSegment

# assign files
input_file = "recording.mp3"
output_file = "result.wav"

# convert mp3 file to wav file
sound = AudioSegment.from_mp3(input_file)
sound.export(output_file, format="wav")

This is the error: enter image description here

CodePudding user response:

Try this:

import subprocess

# convert wav to mp3
subprocess.call(['ffmpeg', '-i', source_path,
                     destination_path])
  • Related