FFmpeg check channels of a 7.1 audio for silence

余生长醉 提交于 2019-12-04 22:06:10

You can use the channelsplit filter to split the audio channels and run silencedetect on each.

Example:

ffmpeg -i test2.mp4 -filter_complex "[0:a]channelsplit=channel_layout=7.1:channels=FC[fc];[fc]silencedetect" -f null /dev/null

You can find more on audio channel manipulation here: https://trac.ffmpeg.org/wiki/AudioChannelManipulation

There is also the astats filter which can be used to detect silent tracks/channels.

This i what it outputs for the channel 4 of the suggest test file, which appears indeed to be perfectly silent.

ffmpeg -i "$in" -vn -sn -dn -map 0:a -af "astats=measure_overall=none" -f null -
...
[Parsed_astats_0 @ 0x6beed00] Channel: 4
[Parsed_astats_0 @ 0x6beed00] DC offset: 0.000000
[Parsed_astats_0 @ 0x6beed00] Min level: 0.000000
[Parsed_astats_0 @ 0x6beed00] Max level: 0.000000
[Parsed_astats_0 @ 0x6beed00] Min difference: 0.000000
[Parsed_astats_0 @ 0x6beed00] Max difference: 0.000000
[Parsed_astats_0 @ 0x6beed00] Mean difference: 0.000000
[Parsed_astats_0 @ 0x6beed00] RMS difference: 0.000000
[Parsed_astats_0 @ 0x6beed00] Peak level dB: -inf
[Parsed_astats_0 @ 0x6beed00] RMS level dB: -inf
[Parsed_astats_0 @ 0x6beed00] RMS peak dB: -inf
[Parsed_astats_0 @ 0x6beed00] RMS trough dB: -inf
[Parsed_astats_0 @ 0x6beed00] Crest factor: 1.000000
[Parsed_astats_0 @ 0x6beed00] Flat factor: -inf
[Parsed_astats_0 @ 0x6beed00] Peak count: 6057984
[Parsed_astats_0 @ 0x6beed00] Bit depth: 0/0
[Parsed_astats_0 @ 0x6beed00] Dynamic range: -inf
[Parsed_astats_0 @ 0x6beed00] Zero crossings: 0
[Parsed_astats_0 @ 0x6beed00] Zero crossings rate: 0.000000
[Parsed_astats_0 @ 0x6beed00] Number of NaNs: 0
[Parsed_astats_0 @ 0x6beed00] Number of Infs: 0
[Parsed_astats_0 @ 0x6beed00] Number of denormals: 0
[Parsed_astats_0 @ 0x6beed00] Channel: 5
...

Something like this would show an overview of all channels:

ffmpeg -i "$in" -vn -sn -dn -map 0:a -af "astats=measure_overall=none" -f null - 2>&1 \
| egrep 'Channel|(Max|Peak) level'
[Parsed_astats_0 @ 0x7567d00] Channel: 1
[Parsed_astats_0 @ 0x7567d00] Max level: 0.978271
[Parsed_astats_0 @ 0x7567d00] Peak level dB: -0.190818
[Parsed_astats_0 @ 0x7567d00] Channel: 2
[Parsed_astats_0 @ 0x7567d00] Max level: 0.978271
[Parsed_astats_0 @ 0x7567d00] Peak level dB: -0.190818
[Parsed_astats_0 @ 0x7567d00] Channel: 3
[Parsed_astats_0 @ 0x7567d00] Max level: 0.000006
[Parsed_astats_0 @ 0x7567d00] Peak level dB: -103.162709
[Parsed_astats_0 @ 0x7567d00] Channel: 4
[Parsed_astats_0 @ 0x7567d00] Max level: 0.000000
[Parsed_astats_0 @ 0x7567d00] Peak level dB: -inf
[Parsed_astats_0 @ 0x7567d00] Channel: 5
[Parsed_astats_0 @ 0x7567d00] Max level: 0.000006
[Parsed_astats_0 @ 0x7567d00] Peak level dB: -103.162709
[Parsed_astats_0 @ 0x7567d00] Channel: 6
[Parsed_astats_0 @ 0x7567d00] Max level: 0.000006
[Parsed_astats_0 @ 0x7567d00] Peak level dB: -103.162709
[Parsed_astats_0 @ 0x7567d00] Channel: 7
[Parsed_astats_0 @ 0x7567d00] Max level: 0.978271
[Parsed_astats_0 @ 0x7567d00] Peak level dB: -0.190818
[Parsed_astats_0 @ 0x7567d00] Channel: 8
[Parsed_astats_0 @ 0x7567d00] Max level: 0.978271
[Parsed_astats_0 @ 0x7567d00] Peak level dB: -0.190818
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!