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")
CodePudding user response:
Try this:
import subprocess
# convert wav to mp3
subprocess.call(['ffmpeg', '-i', source_path,
destination_path])