AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / computer / 问题 / 1424343
Accepted
ladderfall
ladderfall
Asked: 2019-04-12 09:01:30 +0800 CST2019-04-12 09:01:30 +0800 CST 2019-04-12 09:01:30 +0800 CST

如何使用 FFmpeg 获得最终的 LUF 值?

  • 772

我正在使用 FFmpeg 从音频文件中获取 LUF 值,但得到了大量的输出。我只想要输出底部附近的最终集成阈值 LUF 值,并且使用 grep 和 regex 取得了一些成功,但我想知道是否有更好的方法只使用 FFmpeg?

这是我使用的命令:

ffmpeg -i test.mp4 -hide_banner -filter_complex ebur128 -f null -

输出是:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.20.100
  Duration: 00:00:05.02, start: 0.000000, bitrate: 780 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 644 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
[Parsed_ebur128_0 @ 0x7feb18604000] Summary:

  Integrated loudness:
    I:         -70.0 LUFS
    Threshold:   0.0 LUFS

  Loudness range:
    LRA:         0.0 LU
    Threshold:   0.0 LUFS
    LRA low:     0.0 LUFS
    LRA high:    0.0 LUFS
Stream mapping:
  Stream #0:1 (aac) -> ebur128 (graph 0)
  ebur128 (graph 0) -> Stream #0:0 (pcm_s16le)
  Stream #0:0 -> #0:1 (h264 (native) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 0.0999792  M:-120.7 S:-120.7     I: -70.0 LUFS     LRA:   0.0 LU
Output #0, null, to 'pipe:':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.12.100
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
      encoder         : Lavc58.18.100 pcm_s16le
    Stream #0:1(und): Video: wrapped_avframe, yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
      encoder         : Lavc58.18.100 wrapped_avframe
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 0.199979   M:-120.7 S:-120.7     I: -70.0 LUFS     LRA:   0.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 0.299979   M:-120.7 S:-120.7     I: -70.0 LUFS     LRA:   0.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 0.399979   M: -27.5 S:-120.7     I: -27.5 LUFS     LRA:   0.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 0.499979   M: -27.9 S:-120.7     I: -27.7 LUFS     LRA:   0.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 0.599979   M: -31.9 S:-120.7     I: -28.7 LUFS     LRA:   0.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 0.699979   M: -34.8 S:-120.7     I: -29.6 LUFS     LRA:   0.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 0.799979   M: -38.1 S:-120.7     I: -30.4 LUFS     LRA:   0.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 0.899979   M: -46.6 S:-120.7     I: -30.4 LUFS     LRA:   0.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 0.999979   M: -49.5 S:-120.7     I: -30.4 LUFS     LRA:   0.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 1.09998    M: -57.2 S:-120.7     I: -30.4 LUFS     LRA:   0.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 1.19998    M: -58.1 S:-120.7     I: -30.4 LUFS     LRA:   0.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 1.29998    M: -58.6 S:-120.7     I: -30.4 LUFS     LRA:   0.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 1.39998    M: -58.8 S:-120.7     I: -30.4 LUFS     LRA:   0.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 1.49998    M: -58.7 S:-120.7     I: -30.4 LUFS     LRA:   0.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 1.59998    M: -51.9 S:-120.7     I: -30.4 LUFS     LRA:   0.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 1.69998    M: -33.7 S:-120.7     I: -30.8 LUFS     LRA:   0.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 1.79998    M: -26.0 S:-120.7     I: -29.7 LUFS     LRA:   0.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 1.89998    M: -22.4 S:-120.7     I: -27.8 LUFS     LRA:   0.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 1.99998    M: -22.0 S:-120.7     I: -26.6 LUFS     LRA:   0.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 2.09998    M: -21.1 S:-120.7     I: -25.7 LUFS     LRA:   0.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 2.19998    M: -21.9 S:-120.7     I: -24.8 LUFS     LRA:   0.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 2.29998    M: -24.5 S:-120.7     I: -24.7 LUFS     LRA:   0.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 2.39998    M: -23.4 S:-120.7     I: -24.6 LUFS     LRA:   0.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 2.49998    M: -22.8 S:-120.7     I: -24.4 LUFS     LRA:   0.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 2.59998    M: -21.5 S:-120.7     I: -24.2 LUFS     LRA:   0.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 2.69998    M: -20.0 S:-120.7     I: -23.7 LUFS     LRA:   0.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 2.79998    M: -19.3 S:-120.7     I: -23.3 LUFS     LRA:   0.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 2.89998    M: -20.2 S:-120.7     I: -23.0 LUFS     LRA:   0.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 2.99998    M: -21.6 S: -24.8     I: -22.7 LUFS     LRA:  20.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 3.09998    M: -24.3 S: -24.8     I: -22.8 LUFS     LRA:  20.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 3.19998    M: -32.7 S: -25.0     I: -23.2 LUFS     LRA:  20.1 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 3.29998    M: -28.6 S: -24.8     I: -23.3 LUFS     LRA:  20.1 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 3.39998    M: -27.0 S: -24.8     I: -23.4 LUFS     LRA:   0.2 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 3.49998    M: -26.3 S: -24.7     I: -23.5 LUFS     LRA:   0.3 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 3.59998    M: -24.9 S: -24.5     I: -23.6 LUFS     LRA:   0.5 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 3.69998    M: -25.7 S: -24.4     I: -23.7 LUFS     LRA:   0.5 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 3.79998    M: -25.5 S: -24.3     I: -23.7 LUFS     LRA:   0.7 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 3.89998    M: -25.6 S: -24.3     I: -23.8 LUFS     LRA:   0.7 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 3.99998    M: -26.7 S: -24.2     I: -23.8 LUFS     LRA:   0.7 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 4.09998    M: -26.9 S: -24.1     I: -23.9 LUFS     LRA:   0.8 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 4.19998    M: -28.3 S: -24.1     I: -24.0 LUFS     LRA:   0.9 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 4.29998    M: -26.3 S: -23.9     I: -24.1 LUFS     LRA:   0.9 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 4.39998    M: -25.8 S: -23.8     I: -24.1 LUFS     LRA:   0.9 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 4.49998    M: -26.5 S: -23.8     I: -24.2 LUFS     LRA:   1.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 4.59998    M: -27.1 S: -23.8     I: -24.2 LUFS     LRA:   1.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 4.69998    M: -30.9 S: -23.9     I: -24.3 LUFS     LRA:   1.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 4.79998    M: -39.0 S: -24.2     I: -24.3 LUFS     LRA:   1.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 4.89998    M: -51.2 S: -24.7     I: -24.3 LUFS     LRA:   1.0 LU
[Parsed_ebur128_0 @ 0x7feb187009c0] t: 4.99998    M: -54.8 S: -24.8     I: -24.3 LUFS     LRA:   1.0 LU
frame=  150 fps=0.0 q=-0.0 Lsize=N/A time=00:00:05.01 bitrate=N/A speed=17.5x    
video:79kB audio:940kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[Parsed_ebur128_0 @ 0x7feb187009c0] Summary:

  Integrated loudness:
    I:         -24.3 LUFS
    Threshold: -35.6 LUFS

  Loudness range:
    LRA:         1.0 LU
    Threshold: -44.4 LUFS
    LRA low:   -24.9 LUFS
    LRA high:  -23.8 LUFS

我想获得-24.3底部附近的数值 LUFS 值。我努力了:

ffmpeg -i test.mp4 -hide_banner -filter_complex ebur128 -f null - 2<&1 | grep -E 'I:.+ LUFS$' | tail -1 | grep -E '\-[0-9\.]+'

取得了一些成功,但我正在寻找一种更有效的方法来做到这一点。

ffmpeg audio grep
  • 2 2 个回答
  • 2720 Views

2 个回答

  • Voted
  1. Best Answer
    llogan
    2019-04-12T09:50:45+08:002019-04-12T09:50:45+08:00

    你可以只使用awk:

    ffmpeg -i input -af ebur128=framelog=verbose -f null - 2>&1 | awk '/I:/{print $2}'
    

    请注意framelog=verbose,具有讽刺意味的是,添加 to 使输出比默认输出更简洁。

    如果你更喜欢使用 JSON,你可以使用loudnorm过滤器来代替print_format=json选项。请参阅loudnorm.rb示例。

    • 3
  2. slhck
    2019-04-16T07:11:17+08:002019-04-16T07:11:17+08:00

    过滤最后 12 行(其中包含来自 的 JSON 日志loudnorm),您可以使用jq它以一种稍微理智的方式解析该值:

    ffmpeg -hide_banner -f lavfi -i sine=duration=5 \
      -filter:a loudnorm=print_format=json -f null /dev/null 2>&1 \
      | tail -n 12 \
      | jq '.["input_i"]|tonumber'
    

    那返回-21.75,没有别的。

    • 0

相关问题

  • 最低比特率 ffmpeg 输出的编解码器和设置

  • 如何用ffmpeg 2.0.2保存TS视频流?

  • 快速提取 I 帧到图像

  • 压缩视频可以解码回未压缩的原始格式吗?

  • 索尼WH-1000XMX2蓝牙耳机无法自动正确连接

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    Windows 10 服务称为 AarSvc_70f961。它是什么,我该如何禁用它?

    • 2 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Marko Smith

    ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败:无法获取本地颁发者证书 (_ssl.c:1056)

    • 4 个回答
  • Marko Smith

    我如何知道 Windows 安装在哪个驱动器上?

    • 6 个回答
  • Martin Hope
    Albin 支持结束后如何激活 WindowsXP? 2019-11-18 03:50:17 +0800 CST
  • Martin Hope
    fixer1234 “HTTPS Everywhere”仍然相关吗? 2019-10-27 18:06:25 +0800 CST
  • Martin Hope
    Kagaratsch Windows 10 删除大量小文件的速度非常慢。有什么办法可以加快速度吗? 2019-09-23 06:05:43 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    Inter Sys Ctrl+C 和 Ctrl+V 是如何工作的? 2019-05-15 02:51:21 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve