【问题标题】:Wav to Wav conversion using subprocess using Python使用 Python 的子进程将 Wav 转换为 Wav
【发布时间】:2021-06-10 04:34:02
【问题描述】:

我正在尝试将 Sr = 16000 和比特率 = 256 的 Wav 文件转换为 Sr = 8000 和比特率 = 128 的单声道音频,但输出文件仍然是 16000。

我使用的命令是:

for file in audio_files:    # Iterate over the audio files.
        name , ext = os.path.splitext (file)    # Splitting the name and extention
        nm = os.path.basename(name)     # Getting file's base name
        sc = wav_audio + "\{0}.wav".format ( nm )
        fl = subprocess.call(['ffmpeg' , '-i', file,'-r', '8000', sc])          

【问题讨论】:

标签: python audio ffmpeg subprocess wave


【解决方案1】:

ffmpeg 命令应该是:

ffmpeg -i input.wav -ar 16000 -ac 1 output.wav

请注意,WAV 是未压缩的,因此您不能设置任意比特率。有关详细信息,请参阅Wav audio file compression not working

【讨论】:

    猜你喜欢
    • 2012-05-04
    • 1970-01-01
    • 2017-08-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-19
    • 1970-01-01
    相关资源
    最近更新 更多