У меня есть куча стереофонических аудиофайлов для анализа, специфичного для каждого канала. В настоящее время я разделяю их на два файла (также с помощью ffmpeg) и запускаю фильтр обнаружения тишины.

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

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

Это прекрасно работает, но я бы предпочел сделать это за один шаг:

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

$ ffmpeg -i stereo.wav -map_channel 0.0.1 -af silencedetect = 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 ответ1

0

Что делает 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

Всё ещё ищете ответ? Посмотрите другие вопросы с метками .