FFMpeg 获取音频音量、提高音量

查看音量

准备原生音频original.mp3

查看original.mp3的音量信息:

bash 复制代码
ffmpeg -i original.mp3 -filter_complex volumedetect -c:v copy -f null /dev/null

输出:

bash 复制代码
Input #0, mp3, from 'original.mp3':
  Metadata:
    artist          : Administrator
    encoder         : Studio One 6.0.1.90430
    TBPM            : 120
    date            : 2023
  Duration: 00:00:26.41, start: 0.025057, bitrate: 320 kb/s
  Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 320 kb/s
    Metadata:
      encoder         : LAME3.100
[Parsed_volumedetect_0 @ 0x55d0ba56dac0] n_samples: 0
Stream mapping:
  Stream #0:0 (mp3float) -> volumedetect:default
  volumedetect:default -> Stream #0:0 (pcm_s16le)
Press [q] to stop, [?] for help
Output #0, null, to '/dev/null':
  Metadata:
    artist          : Administrator
    date            : 2023
    TBPM            : 120
    encoder         : Lavf60.3.100
  Stream #0:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
    Metadata:
      encoder         : Lavc60.3.100 pcm_s16le
size=N/A time=00:00:26.35 bitrate=N/A speed= 684x    A    
video:0kB audio:4544kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[Parsed_volumedetect_0 @ 0x55d0ba59c280] n_samples: 2326514
[Parsed_volumedetect_0 @ 0x55d0ba59c280] mean_volume: -35.5 dB
[Parsed_volumedetect_0 @ 0x55d0ba59c280] max_volume: -13.8 dB
[Parsed_volumedetect_0 @ 0x55d0ba59c280] histogram_13db: 8
[Parsed_volumedetect_0 @ 0x55d0ba59c280] histogram_14db: 99
[Parsed_volumedetect_0 @ 0x55d0ba59c280] histogram_15db: 189
[Parsed_volumedetect_0 @ 0x55d0ba59c280] histogram_16db: 191
[Parsed_volumedetect_0 @ 0x55d0ba59c280] histogram_17db: 273
[Parsed_volumedetect_0 @ 0x55d0ba59c280] histogram_18db: 596
[Parsed_volumedetect_0 @ 0x55d0ba59c280] histogram_19db: 1003

音量平均值:mean_volume: -35.5 dB

音量最大值:max_volume: -13.8 dB

提高音量

bash 复制代码
ffmpeg -i original.mp3 -af "volume=3.0,highpass=f=200,lowpass=f=3000,afftdn=nr=50" original.volume=3.0,highpass=f=200,lowpass=f=3000,afftdn=nr=50.wav

参数简单说明下:

volume:提供响度,3.0表示提高为原来的3倍;

hightpass:高通滤波器;

lowpass:低通滤波器;

afftdn:使用FFT对音频样本进行降噪

输出:

bash 复制代码
Input #0, mp3, from 'original.mp3':
  Metadata:
    artist          : Administrator
    encoder         : Studio One 6.0.1.90430
    TBPM            : 120
    date            : 2023
  Duration: 00:00:26.41, start: 0.025057, bitrate: 320 kb/s
  Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 320 kb/s
    Metadata:
      encoder         : LAME3.100
Stream mapping:
  Stream #0:0 -> #0:0 (mp3 (mp3float) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, wav, to 'original.volume=3.0,highpass=f=200,lowpass=f=3000,afftdn=nr=50.wav':
  Metadata:
    IART            : Administrator
    ICRD            : 2023
    TBPM            : 120
    ISFT            : Lavf60.3.100
  Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
    Metadata:
      encoder         : Lavc60.3.100 pcm_s16le
size=    4544kB time=00:00:26.37 bitrate=1411.4kbits/s speed= 165x       
video:0kB audio:4544kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.002450%

在提高音量后,再看看音量信息:

bash 复制代码
ffmpeg -i original.volume\=3.0\,highpass\=f\=200\,lowpass\=f\=3000\,afftdn\=nr\=50.wav -filter_complex volumedetect -c:v copy -f null /dev/null

输出:

bash 复制代码
Input #0, wav, from 'original.volume=3.0,highpass=f=200,lowpass=f=3000,afftdn=nr=50.wav':
  Metadata:
    artist          : Administrator
    date            : 2023
    encoder         : Lavf60.3.100
  Duration: 00:00:26.38, bitrate: 1411 kb/s
  Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
[Parsed_volumedetect_0 @ 0x55819c4a4200] n_samples: 0
Stream mapping:
  Stream #0:0 (pcm_s16le) -> volumedetect:default
  volumedetect:default -> Stream #0:0 (pcm_s16le)
Press [q] to stop, [?] for help
Output #0, null, to '/dev/null':
  Metadata:
    artist          : Administrator
    date            : 2023
    encoder         : Lavf60.3.100
  Stream #0:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
    Metadata:
      encoder         : Lavc60.3.100 pcm_s16le
size=N/A time=00:00:26.35 bitrate=N/A speed=1.88e+03x     
video:0kB audio:4544kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[Parsed_volumedetect_0 @ 0x55819c4c35c0] n_samples: 2326514
[Parsed_volumedetect_0 @ 0x55819c4c35c0] mean_volume: -33.3 dB
[Parsed_volumedetect_0 @ 0x55819c4c35c0] max_volume: -7.7 dB
[Parsed_volumedetect_0 @ 0x55819c4c35c0] histogram_7db: 6
[Parsed_volumedetect_0 @ 0x55819c4c35c0] histogram_8db: 18
[Parsed_volumedetect_0 @ 0x55819c4c35c0] histogram_9db: 63
[Parsed_volumedetect_0 @ 0x55819c4c35c0] histogram_10db: 78
[Parsed_volumedetect_0 @ 0x55819c4c35c0] histogram_11db: 123
[Parsed_volumedetect_0 @ 0x55819c4c35c0] histogram_12db: 236
[Parsed_volumedetect_0 @ 0x55819c4c35c0] histogram_13db: 324
[Parsed_volumedetect_0 @ 0x55819c4c35c0] histogram_14db: 474
[Parsed_volumedetect_0 @ 0x55819c4c35c0] histogram_15db: 732
[Parsed_volumedetect_0 @ 0x55819c4c35c0] histogram_16db: 1144

音量平均值:mean_volume: -33.3 dB

音量最大值:max_volume: -7.7 dB

相关推荐
weixin_452600692 小时前
【青牛科技】电流模式PWM控制器系列--D4870
科技·单片机·嵌入式硬件·音视频·智能电表·白色家电电源·机顶盒电源
LNTON羚通6 小时前
摄像机视频分析软件下载LiteAIServer视频智能分析平台玩手机打电话检测算法技术的实现
算法·目标检测·音视频·监控·视频监控
小屁孩大帅-杨一凡10 小时前
Python-flet实现个人视频播放器
开发语言·python·音视频
EasyCVR13 小时前
私有化部署视频平台EasyCVR宇视设备视频平台如何构建视频联网平台及升级视频转码业务?
大数据·网络·音视频·h.265
天空中的野鸟13 小时前
Android音频采集
android·音视频
计算机毕设孵化场14 小时前
计算机毕设-基于springboot的高校网上缴费综合务系统视频的设计与实现(附源码+lw+ppt+开题报告)
java·spring boot·计算机外设·音视频·课程设计·高校网上缴费综合务系统视频·计算机毕设ppt
lxkj_202419 小时前
使用线程局部存储解决ffmpeg中多实例调用下自定义日志回调问题
ffmpeg
简鹿办公21 小时前
如何提取某站 MV 视频中的音乐为 MP3 音频
音视频·简鹿视频格式转换器·视频提取mp3音频
yufengxinpian21 小时前
集成了高性能ARM Cortex-M0+处理器的一款SimpleLink 2.4 GHz无线模块-RF-BM-2340B1
单片机·嵌入式硬件·音视频·智能硬件
runing_an_min1 天前
ffmpeg视频滤镜:替换部分帧-freezeframes
ffmpeg·音视频·freezeframes