如何重新排序 .wav 文件通道

How to re-order the .wav file channels

我需要更改 .wav 文件中的声道顺序。例如,如果 .wav 文件包含 16 个通道,如

"0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"

然后需要将此顺序更改为

"13 14 15 0 1 2 3 4 5 6 7 8 9 10 11 12"

使用任何 python 模块。

import subprocess

cmd = 'ffmpeg -i tdm2_no_ch_map_1.wav -af "channelmap=13|14|15|0|1|2|3|4|5|6|7|8|9|10|11|12" -c:a pcm_s32le out.wav'

cmd = subprocess.Popen(cmd)  # , stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
out, err = cmd.communicate()
print(err)

先决条件: ffmpeg-https://m.wikihow.com/Install-FFmpeg-on-Windows#step_2_1

Note: tested this code on windows machine