将特定通道应用于 ffmpeg 过滤器

将特定通道应用于 ffmpeg 过滤器

我有一堆立体声音频文件需要针对每个声道进行分析。目前我将它们拆分成两个文件(也使用 ffmpeg)并运行静音检测过滤器。

$ ffmpeg -i left.wav -af silentdetect=noise=-60dB:d=2 -f null /dev/null

$ ffmpeg -i right.wav -af silentdetect=noise=-60dB:d=2 -f null /dev/null

这很好,但我更喜欢一步一步地完成:

$ ffmpeg -i stereo.wav -map_channel 0.0.0 -af silentdetect=noise=-60dB:d=2 -f null /dev/null

$ ffmpeg -i stereo.wav -map_channel 0.0.1 -af silentdetect=noise=-60dB:d=2 -f null /dev/null

这会产生截然不同的结果:

单一方法

左声道

[silencedetect @ 0x7fe2cc5001a0] silence_start: 11.568
[silencedetect @ 0x7fe2cc5001a0] silence_end: 17.152 | silence_duration: 5.584
[silencedetect @ 0x7fe2cc5001a0] silence_start: 18.736
[silencedetect @ 0x7fe2cc5001a0] silence_end: 27.648 | silence_duration: 8.912
[silencedetect @ 0x7fe2cc5001a0] silence_start: 27.696
[silencedetect @ 0x7fe2cc5001a0] silence_end: 30.208 | silence_duration: 2.512
[silencedetect @ 0x7fe2cc5001a0] silence_start: 44.848
[silencedetect @ 0x7fe2cc5001a0] silence_end: 48.128 | silence_duration: 3.28
[silencedetect @ 0x7fe2cc5001a0] silence_start: 58.672
[silencedetect @ 0x7fe2cc5001a0] silence_end: 64.512 | silence_duration: 5.84
[silencedetect @ 0x7fe2cc5001a0] silence_start: 65.328
[silencedetect @ 0x7fe2cc5001a0] silence_end: 67.84 | silence_duration: 2.512
[silencedetect @ 0x7fe2cc5001a0] silence_start: 73.264
[silencedetect @ 0x7fe2cc5001a0] silence_end: 77.824 | silence_duration: 4.56
[silencedetect @ 0x7fe2cc5001a0] silence_start: 95.28
[silencedetect @ 0x7fe2cc5001a0] silence_end: 98.56 | silence_duration: 3.28...

右通道

[silencedetect @ 0x7fb2bc4010c0] silence_start: 31.536
[silencedetect @ 0x7fb2bc4010c0] silence_end: 35.584 | silence_duration: 4.048
[silencedetect @ 0x7fb2bc4010c0] silence_start: 40.24
[silencedetect @ 0x7fb2bc4010c0] silence_end: 47.36 | silence_duration: 7.12
[silencedetect @ 0x7fb2bc4010c0] silence_start: 49.968
[silencedetect @ 0x7fb2bc4010c0] silence_end: 57.6 | silence_duration: 7.632
[silencedetect @ 0x7fb2bc4010c0] silence_start: 69.68
[silencedetect @ 0x7fb2bc4010c0] silence_end: 72.448 | silence_duration: 2.768
[silencedetect @ 0x7fb2bc4010c0] silence_start: 86.064
[silencedetect @ 0x7fb2bc4010c0] silence_end: 93.184 | silence_duration: 7.12
[silencedetect @ 0x7fb2bc4010c0] silence_start: 189.744
[silencedetect @ 0x7fb2bc4010c0] silence_end: 193.024 | silence_duration: 3.28
[silencedetect @ 0x7fb2bc4010c0] silence_start: 195.632
[silencedetect @ 0x7fb2bc4010c0] silence_end: 207.104 | silence_duration: 11.472
[silencedetect @ 0x7fb2bc4010c0] silence_start: 208.944
[silencedetect @ 0x7fb2bc4010c0] silence_end: 225.024 | silence_duration: 16.08
[silencedetect @ 0x7fb2bc4010c0] silence_start: 249.648
[silencedetect @ 0x7fb2bc4010c0] silence_end: 254.72 | silence_duration: 5.072
[silencedetect @ 0x7fb2bc4010c0] silence_start: 258.608
[silencedetect @ 0x7fb2bc4010c0] silence_end: 264.448 | silence_duration: 5.84...

立体声

左声道

[silencedetect @ 0x7ffe8b7009e0] silence_start: 44.976
[silencedetect @ 0x7ffe8b7009e0] silence_end: 47.36 | silence_duration: 2.384
[silencedetect @ 0x7ffe8b7009e0] silence_start: 218.416
[silencedetect @ 0x7ffe8b7009e0] silence_end: 223.232 | silence_duration: 4.816
[silencedetect @ 0x7ffe8b7009e0] silence_start: 301.744
[silencedetect @ 0x7ffe8b7009e0] silence_end: 305.28 | silence_duration: 3.536
[silencedetect @ 0x7ffe8b7009e0] silence_start: 365.488
[silencedetect @ 0x7ffe8b7009e0] silence_end: 367.488 | silence_duration: 2

右通道

[silencedetect @ 0x7fb426e04500] silence_start: 44.976
[silencedetect @ 0x7fb426e04500] silence_end: 47.36 | silence_duration: 2.384
[silencedetect @ 0x7fb426e04500] silence_start: 218.416
[silencedetect @ 0x7fb426e04500] silence_end: 223.232 | silence_duration: 4.816
[silencedetect @ 0x7fb426e04500] silence_start: 301.744
[silencedetect @ 0x7fb426e04500] silence_end: 305.28 | silence_duration: 3.536
[silencedetect @ 0x7fb426e04500] silence_start: 365.488
[silencedetect @ 0x7fb426e04500] silence_end: 367.488 | silence_duration: 2

有人能给我指出正确的方向吗?

答案1

map_channel 的作用是插入平移滤波器,但它是在应用任何音频滤波器之后执行此操作。

您应该事先手动插入锅。

ffmpeg -i stereo.wav -af "pan=1c|c0=c0,silencedetect=noise=-60dB:d=2" -f null /dev/null

ffmpeg -i stereo.wav -af "pan=1c|c0=c1,silencedetect=noise=-60dB:d=2" -f null /dev/null

相关内容