[Multimedia][ffmpeg] 音频音量获取
2023-08-16 15:06 shaobin0604 阅读(263) 评论(0) 编辑 收藏 举报ffmpeg -i ~/media/test.mp4 -filter_complex volumedetect -c:v copy -f null /dev/null
...
[Parsed_volumedetect_0 @ 0x7f83a481c000] n_samples: 23887872
[Parsed_volumedetect_0 @ 0x7f83a481c000] mean_volume: -16.7 dB
[Parsed_volumedetect_0 @ 0x7f83a481c000] max_volume: -0.7 dB
[Parsed_volumedetect_0 @ 0x7f83a481c000] histogram_0db: 1
[Parsed_volumedetect_0 @ 0x7f83a481c000] histogram_1db: 0
[Parsed_volumedetect_0 @ 0x7f83a481c000] histogram_2db: 0
[Parsed_volumedetect_0 @ 0x7f83a481c000] histogram_3db: 2
[Parsed_volumedetect_0 @ 0x7f83a481c000] histogram_4db: 7
[Parsed_volumedetect_0 @ 0x7f83a481c000] histogram_5db: 45
[Parsed_volumedetect_0 @ 0x7f83a481c000] histogram_6db: 583
[Parsed_volumedetect_0 @ 0x7f83a481c000] histogram_7db: 17653
[Parsed_volumedetect_0 @ 0x7f83a481c000] histogram_8db: 302630
或
ffmpeg -i your_audio_file.mp3 -af "volumedetect" -vn -sn -dn -f null /dev/null 2>&1 | grep "mean_volume"
...
[Parsed_volumedetect_0 @ 0x55e2660ec4c0] mean_volume: -14.3 dB