FFmpeg check channels of a 7.1 audio for silence

2019-06-09 22:58发布

This is a follow-up question from my previous question asked here, where I needed to look for silence within a specific audio track. Here is the ffmpeg life-saver solution where helps to get some metadata:

ffmpeg -i file -map 0:a:1 -af astats -f null -

But I have other type of input .mp4 files where they have one single track of 8 (i.e. 7.1) audio channels. Apparently these files are transcoded from an original file (somehow the 4 track stereos are squished into these files). Now similar to my previous, I need to know if the original file was 2-channel stereo or 5.1 (6) channel.

How to know if a specific channel of an audio track (say Center channel) is silent/mute, possibly using ffmpeg? Here is a sample .mp4 file.

1条回答
太酷不给撩
2楼-- · 2019-06-09 23:29

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

查看更多
登录 后发表回答