关于ffmpeg:由VLC音量超100导致蓝牙播放器炸音的现象而获得的一些发现

55次阅读

共计 12254 个字符,预计需要花费 31 分钟才能阅读完成。

1. 状况形容

在 M1 芯片的 macOS 12.3.1 的零碎上装置了最新的 VLC 视频播放器,并将音量调至 200%,此时播放低频且富裕变动的音乐,JBL 蓝牙播放器会呈现咔次的炸音且细节全糊,原本流动的声音一卡一卡的,很刺耳。

2. 修复

把 VLC 设定的音量调至 100% 及以下即可。

3. 剖析

因为我之前看另一部电影把声音调至了 200% 且没有呈现任何问题,我想晓得问题出在哪里。
猜想是 vlc 的音量冲破 100% 时的算法会做相当于批改音轨内容的操作,导致解析失败,而放出杂音。

首先,这个电影文件用 ffprobe 能够看到

$ ffprobe Dune.2021.UHD.BluRay.2160p.x265.10bit.DoVi.2Audio.mUHD-FRDS.mkv
ffprobe version 4.4 Copyright (c) 2007-2021 the FFmpeg developers
  built with Apple clang version 12.0.5 (clang-1205.0.22.9)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/4.4_2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
[matroska,webm @ 0x13b019600] Could not find codec parameters for stream 5 (Subtitle: hdmv_pgs_subtitle (pgssub)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[matroska,webm @ 0x13b019600] Could not find codec parameters for stream 6 (Subtitle: hdmv_pgs_subtitle (pgssub)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[matroska,webm @ 0x13b019600] Could not find codec parameters for stream 7 (Subtitle: hdmv_pgs_subtitle (pgssub)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, matroska,webm, from 'Dune.2021.UHD.BluRay.2160p.x265.10bit.DoVi.2Audio.mUHD-FRDS.mkv':
  Metadata:
    encoder         : libebml v1.4.2 + libmatroska v1.6.4
    creation_time   : 2021-12-25T09:11:56.000000Z
  Duration: 02:35:26.64, start: 0.000000, bitrate: 22814 kb/s
  Chapters:
    Chapter #0:0: start 0.000000, end 196.154289
      Metadata:
        title           : 第 01 章
    Chapter #0:1: start 196.154289, end 774.815689
      Metadata:
        title           : 第 02 章
    Chapter #0:2: start 774.815689, end 1320.736067
      Metadata:
        title           : 第 03 章
    Chapter #0:3: start 1320.736067, end 1756.921822
      Metadata:
        title           : 第 04 章
    Chapter #0:4: start 1756.921822, end 2350.931911
      Metadata:
        title           : 第 05 章
    Chapter #0:5: start 2350.931911, end 2839.795289
      Metadata:
        title           : 第 06 章
    Chapter #0:6: start 2839.795289, end 3413.493400
      Metadata:
        title           : 第 07 章
    Chapter #0:7: start 3413.493400, end 4010.381356
      Metadata:
        title           : 第 08 章
    Chapter #0:8: start 4010.381356, end 4604.891956
      Metadata:
        title           : 第 09 章
    Chapter #0:9: start 4604.891956, end 5160.655489
      Metadata:
        title           : 第 10 章
    Chapter #0:10: start 5160.655489, end 5760.379622
      Metadata:
        title           : 第 11 章
    Chapter #0:11: start 5760.379622, end 6309.469822
      Metadata:
        title           : 第 12 章
    Chapter #0:12: start 6309.469822, end 6830.323489
      Metadata:
        title           : 第 13 章
    Chapter #0:13: start 6830.323489, end 7418.536111
      Metadata:
        title           : 第 14 章
    Chapter #0:14: start 7418.536111, end 7933.342067
      Metadata:
        title           : 第 15 章
    Chapter #0:15: start 7933.342067, end 8445.770667
      Metadata:
        title           : 第 16 章
    Chapter #0:16: start 8445.770667, end 8847.797289
      Metadata:
        title           : 第 17 章
    Chapter #0:17: start 8847.797289, end 9326.635000
      Metadata:
        title           : 第 18 章
  Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 3840x1604, SAR 1:1 DAR 960:401, 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc (default)
    Metadata:
      BPS             : 14748974
      DURATION        : 02:35:26.609000000
      NUMBER_OF_FRAMES: 223615
      NUMBER_OF_BYTES : 17194739399
      _STATISTICS_WRITING_APP: mkvmerge v62.0.0 ('Apollo') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2021-12-25 09:11:56
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:1(eng): Audio: truehd, 48000 Hz, 7.1, s32 (24 bit) (default)
    Metadata:
      title           : 原声
      BPS             : 3242671
      DURATION        : 02:35:26.610000000
      NUMBER_OF_FRAMES: 11191931
      NUMBER_OF_BYTES : 3780391034
      _STATISTICS_WRITING_APP: mkvmerge v62.0.0 ('Apollo') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2021-12-25 09:11:56
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:2(chi): Audio: dts (DTS-HD MA), 48000 Hz, 7.1, s32p (24 bit) (default)
    Metadata:
      title           : 上译国语
      BPS             : 4702403
      DURATION        : 02:35:26.635000000
      NUMBER_OF_FRAMES: 874372
      NUMBER_OF_BYTES : 5482200184
      _STATISTICS_WRITING_APP: mkvmerge v62.0.0 ('Apollo') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2021-12-25 09:11:56
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:3(chi): Subtitle: hdmv_pgs_subtitle, 1920x1080 (default)
    Metadata:
      title           : 国配特效
      BPS             : 13781
      DURATION        : 02:35:25.483000000
      NUMBER_OF_FRAMES: 3269
      NUMBER_OF_BYTES : 16064721
      SOURCE_ID       : 0012ab
      _STATISTICS_WRITING_APP: mkvmerge v62.0.0 ('Apollo') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2021-12-25 09:11:56
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
  Stream #0:4(chi): Subtitle: hdmv_pgs_subtitle, 1920x1080
    Metadata:
      title           : 双语特效
      BPS             : 20918
      DURATION        : 02:35:25.483000000
      NUMBER_OF_FRAMES: 3203
      NUMBER_OF_BYTES : 24384886
      SOURCE_ID       : 0012a9
      _STATISTICS_WRITING_APP: mkvmerge v62.0.0 ('Apollo') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2021-12-25 09:11:56
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
  Stream #0:5(chi): Subtitle: hdmv_pgs_subtitle
    Metadata:
      title           : 简中
      BPS             : 20158
      DURATION        : 02:28:42.914000000
      NUMBER_OF_FRAMES: 2514
      NUMBER_OF_BYTES : 22484517
      _STATISTICS_WRITING_APP: mkvmerge v62.0.0 ('Apollo') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2021-12-25 09:11:56
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:6(chi): Subtitle: hdmv_pgs_subtitle
    Metadata:
      title           : 繁中
      BPS             : 19753
      DURATION        : 02:35:12.929000000
      NUMBER_OF_FRAMES: 2360
      NUMBER_OF_BYTES : 22995600
      SOURCE_ID       : 0012a5
      _STATISTICS_WRITING_APP: mkvmerge v62.0.0 ('Apollo') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2021-12-25 09:11:56
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
  Stream #0:7(chi): Subtitle: hdmv_pgs_subtitle
    Metadata:
      title           : 繁中
      BPS             : 18295
      DURATION        : 02:35:12.929000000
      NUMBER_OF_FRAMES: 2514
      NUMBER_OF_BYTES : 21297928
      SOURCE_ID       : 0012a6
      _STATISTICS_WRITING_APP: mkvmerge v62.0.0 ('Apollo') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2021-12-25 09:11:56
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID

其中,视频 Video: hevc (Main 10), yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 3840x1604, SAR 1:1 DAR 960:401, 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc (default),4k 24fps,且码率是 14748974,大略是 1.76MB/s。
音轨有两个,英语的是杜比全景声,上译国语的是 DTS-HD,码率别离达到了 0.39MB/ s 和 0.56MB/s。
感叹一下,这个码率简直相当于按下面的 4k 降到 1080P(1920*1080,靠近 1 /4)的码率了,如果是一首 3 分钟的音乐,按 0.39MB/s,就有 70MB 了。

之前看的是

$ ffprobe Malena\ 2000\ 1080p\ BluRay\ DD+5.1\ x264-Geek.mkv
ffprobe version 4.4 Copyright (c) 2007-2021 the FFmpeg developers
  built with Apple clang version 12.0.5 (clang-1205.0.22.9)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/4.4_2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, matroska,webm, from 'Malena 2000 1080p BluRay DD+5.1 x264-Geek.mkv':
  Metadata:
    title           : Malèna [2000] by Giuseppe Tornatore / Uncut / KOR BD
    encoder         : libebml v1.4.0 + libmatroska v1.6.2
    creation_time   : 2021-10-08T11:56:47.000000Z
  Duration: 01:48:05.02, start: 0.000000, bitrate: 18216 kb/s
  Chapters:
    Chapter #0:0: start 0.000000, end 245.787000
      Metadata:
        title           : Opening Credits
    Chapter #0:1: start 245.787000, end 345.720000
      Metadata:
        title           : Shut Up And Watch!
    Chapter #0:2: start 345.720000, end 434.976000
      Metadata:
        title           : Latin Teacher's Daughter
    Chapter #0:3: start 434.976000, end 548.423000
      Metadata:
        title           : Measuring Up
    Chapter #0:4: start 548.423000, end 744.827000
      Metadata:
        title           : Long Pants And A Promise
    Chapter #0:5: start 744.827000, end 936.227000
      Metadata:
        title           : Her Husband Gone Off To War
    Chapter #0:6: start 936.227000, end 1132.298000
      Metadata:
        title           : Ma L'Amore No
    Chapter #0:7: start 1132.298000, end 1295.503000
      Metadata:
        title           : Imaging It
    Chapter #0:8: start 1295.503000, end 1583.123000
      Metadata:
        title           : A Stroll Through The Streets
    Chapter #0:9: start 1583.123000, end 1644.476000
      Metadata:
        title           : Great Jealousy
    Chapter #0:10: start 1644.476000, end 1885.634000
      Metadata:
        title           : A Beautiful, Silent Outsider
    Chapter #0:11: start 1885.634000, end 2157.906000
      Metadata:
        title           : Mourning With Malena
    Chapter #0:12: start 2157.906000, end 2303.092000
      Metadata:
        title           : Malena's Protector
    Chapter #0:13: start 2303.092000, end 2476.933000
      Metadata:
        title           : Stealing Malena's Underwear
    Chapter #0:14: start 2476.933000, end 2520.768000
      Metadata:
        title           : A Very Long Night
    Chapter #0:15: start 2520.768000, end 2714.962000
      Metadata:
        title           : Prisoner Of The House
    Chapter #0:16: start 2714.962000, end 2804.343000
      Metadata:
        title           : You're Dishonored
    Chapter #0:17: start 2804.343000, end 2944.150000
      Metadata:
        title           : Lieutenant And Dentist
    Chapter #0:18: start 2944.150000, end 3131.628000
      Metadata:
        title           : Dishonor For Malena
    Chapter #0:19: start 3131.628000, end 3582.412000
      Metadata:
        title           : Ill Fated, Alone And Beautiful
    Chapter #0:20: start 3582.412000, end 3818.523000
      Metadata:
        title           : Don't Marry Him
    Chapter #0:21: start 3818.523000, end 4008.838000
      Metadata:
        title           : Lawyer's Restribution
    Chapter #0:22: start 4008.838000, end 4174.712000
      Metadata:
        title           : Aerial Assault
    Chapter #0:23: start 4174.712000, end 4452.281000
      Metadata:
        title           : In The Lord's Hands
    Chapter #0:24: start 4452.281000, end 4621.534000
      Metadata:
        title           : A New Malena
    Chapter #0:25: start 4621.534000, end 4752.289000
      Metadata:
        title           : Possessed By The Devil
    Chapter #0:26: start 4752.289000, end 5026.271000
      Metadata:
        title           : It's My First Time
    Chapter #0:27: start 5026.271000, end 5319.940000
      Metadata:
        title           : A Wicked End
    Chapter #0:28: start 5319.940000, end 5905.817000
      Metadata:
        title           : Nine Scordia's Return
    Chapter #0:29: start 5905.817000, end 6485.024000
      Metadata:
        title           : Regaining One's Dignity / End Credits
  Stream #0:0(ita): Video: h264 (High), yuv420p(tv, bt709/bt709/unknown, progressive), 1920x818, SAR 1:1 DAR 960:409, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Metadata:
      title           : Geek @ MTeam
      BPS-eng         : 17191376
      DURATION-eng    : 01:48:04.979000000
      NUMBER_OF_FRAMES-eng: 155484
      NUMBER_OF_BYTES-eng: 13935714442
      _STATISTICS_WRITING_APP-eng: mkvmerge v51.0.0 ('I Wish') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2021-10-08 11:56:47
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:1(ita): Audio: eac3, 48000 Hz, 5.1(side), fltp, 1023 kb/s (default)
    Metadata:
      title           : Italian / Dolby Digital Plus / 5.1 / 1023 kbps
      BPS-eng         : 1023000
      DURATION-eng    : 01:48:05.024000000
      NUMBER_OF_FRAMES-eng: 607971
      NUMBER_OF_BYTES-eng: 829272444
      _STATISTICS_WRITING_APP-eng: mkvmerge v51.0.0 ('I Wish') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2021-10-08 11:56:47
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:2(eng): Subtitle: subrip (default)
    Metadata:
      title           : English / R2DVD / Medusa / srt
      BPS-eng         : 31
      DURATION-eng    : 01:43:36.366000000
      NUMBER_OF_FRAMES-eng: 668
      NUMBER_OF_BYTES-eng: 24327
      _STATISTICS_WRITING_APP-eng: mkvmerge v51.0.0 ('I Wish') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2021-10-08 11:56:47
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:3(chi): Subtitle: subrip
    Metadata:
      title           : Simplified / Custom / CnSCG / srt
      BPS-eng         : 27
      DURATION-eng    : 01:47:58.000000000
      NUMBER_OF_FRAMES-eng: 703
      NUMBER_OF_BYTES-eng: 22433
      _STATISTICS_WRITING_APP-eng: mkvmerge v51.0.0 ('I Wish') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2021-10-08 11:56:47
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:4(chi): Subtitle: subrip
    Metadata:
      title           : Traditional / Custom / CnSCG / srt
      BPS-eng         : 27
      DURATION-eng    : 01:47:58.000000000
      NUMBER_OF_FRAMES-eng: 703
      NUMBER_OF_BYTES-eng: 22433
      _STATISTICS_WRITING_APP-eng: mkvmerge v51.0.0 ('I Wish') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2021-10-08 11:56:47
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES

能够看到这里 h264 的 1080P 的视频码率(17191376)比前一个 h265 的 4k 的视频码率(14748974)还大。。。
查到一部 1080P H265 压缩的是 9510 kbps, 压缩了靠近 45%。。。

VIDEO CODEC.....: x265, CRF, Main 10@L5@High
FRAMERATE.......: 24.000 FPS
VIDEO BITRATE...: 9510 kbps

正文完
 0