Answers for "python mp4 to wav"

1

convert mp3 to wav python

from os import path
from pydub import AudioSegment

# files
src = input("In: ")
dst = input("Out: ")

# convert mp3 to wav
sound = AudioSegment.from_mp3(src)
sound.export(dst, format="wav")
Posted by: Guest on March-19-2020
0

python m4a to wav

#!/usr/bin/env python

import os
import commands

import logging
import traceback

if __name__ == '__main__':
    outputdir = os.path.abspath(“<path to output>”)
    for root, dirs, files in os.walk('.'):
        for f in files:
            path = os.path.join(root, f)
            base, ext = os.path.splitext(f)
            outputpath = os.path.join(outputdir, base + ".wav")
            if ext == '.m4a':
                print 'converting %s to %s' % (path, outputpath)
                status, output = commands.getstatusoutput('ffmpeg -i "%s" "%s"' % (path, outputpath))
                if status:
                    logging.error (output)
Posted by: Guest on July-06-2020

Python Answers by Framework

Browse Popular Code Answers by Language