[FFmpeg-trac] #8488(undetermined:new): Bug in loudness normalizing WAV files
FFmpeg
trac at avcodec.org
Sun Jan 19 22:35:58 EET 2020
#8488: Bug in loudness normalizing WAV files
-------------------------------------+-------------------------------------
Reporter: | Type: defect
unclefreddie70 |
Status: new | Priority: normal
Component: | Version: git-
undetermined | master
Keywords: loudnorm | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Hi,
Found a bug in the latest snapshot of ffmpeg, N-96399-g6e082f9f04-tessus,
while trying to loudness normalize a 16/44 WAV file using the standard
dual-pass method.
The bug is that under certain yet-to-be-understood conditions, when a WAV
file is true-peak loudness normalized, '''sometimes''' the resultant
output file is sample rate converted down to 44.1k instead of being output
at the expected 192k. The option "-ar 44100" is never specified on the
command-line, so '''the output is expected to default to a sample rate of
192k, not 44.1k or any other sample rate.'''
IMPORTANT: '''The bug does not occur with all WAV files'''; I have other
input WAV files where the output file has the correct, expected sample
rate of 192k.
So it seems that the bug is somehow related to the content of the input
file, strangely.
Below are two tests:
TEST 1 uses a WAV file that for some reason triggers the bug;
TEST 2 uses a WAV file that for some reason DOES NOT trigger the bug.
I have provided direct URLs to all test files and test results; all
results output was generated via "ffmpeg -report -v 9 -loglevel 99 ...".
(Irrelevant to devs, but perhaps worth noting that the bug happens as well
on the release versions 4.2.2 and 4.2.1; it happens on both statically
linked and shared lib versions; it does NOT happen with 3.3.3. I have not
tried any other versions.)
[[BR]]
[[BR]]
[[BR]]
'''TEST INPUT FILES, BAD AND GOOD'''
Test input file 1 is a 1-minute 16/44 WAV file that triggers the bug:
[http://substrate.com/ffmpegbug/test1/ffmpegtest_badfile1_1m.wav]
Test input file 2 is a 1-minute 16/44 WAV file that DOES NOT trigger the
bug:
[http://substrate.com/ffmpegbug/test2/ffmpegtest_goodfile2_1m.wav]
[[BR]]
[[BR]]
[[BR]]
'''COMMAND LINES AND FULL CONSOLE OUTPUTS'''
'''TEST 1: THIS WAV FILE TRIGGERS THE BUG'''
'''TEST 1 PASS 1: collect loudness stats'''
{{{
$ /opt/ff/96399-g6e082f9f04/bin/ffmpeg \
-report -v 9 -loglevel 99 \
-i \
ffmpegtest_badfile1_1m.wav \
-af \
loudnorm=\
I=-13.00:\
TP=-1.00:\
print_format=json \
-f null \
- \
2>&1
}}}
'''TEST 1 PASS 1 FULL RESULTS:'''
[http://substrate.com/ffmpegbug/test1/ffmpeg-20200119-125201.log]
'''TEST 1 PASS 1 JSON object:'''
{{{
{
"input_i" : "-9.99",
"input_tp" : "1.86",
"input_lra" : "4.30",
"input_thresh" : "-20.02",
"output_i" : "-12.12",
"output_tp" : "-1.00",
"output_lra" : "3.30",
"output_thresh" : "-22.15",
"normalization_type" : "dynamic",
"target_offset" : "-0.88"
}
}}}
'''TEST 1 PASS 2: use JSON results from pass 1 to normalize the file'''
'''NOTE THAT -ar IS NOT SPECIFIED HERE'''
{{{
$ /opt/ff/96399-g6e082f9f04/bin/ffmpeg \
-report -v 9 -loglevel 99 \
-y \
-i \
ffmpegtest_badfile1_1m.wav \
-af \
loudnorm=\
I=-13.00:\
TP=-1.00:\
measured_I=-9.99:\
measured_TP=1.86:\
measured_LRA=4.30:\
measured_thresh=-20.02:\
offset=-0.88:\
linear=true:\
print_format=summary \
ffmpegtest_badfile1_1m_normalized.wav
}}}
'''TEST 1 PASS 2 FULL RESULTS:'''
[http://substrate.com/ffmpegbug/test1/ffmpeg-20200119-125307.log]
'''TEST 1 PASS 2 OUTPUT FILE:'''
[http://substrate.com/ffmpegbug/test1/ffmpegtest_badfile1_1m_normalized.wav]
'''CONFIRM OUTPUT FILE SAMPLE RATE:'''
{{{
$ soxi ffmpegtest_badfile1_1m_normalized.wav | grep "Sample Rate"
Sample Rate : 44100
}}}
'''EXPECTED RESULT:'''
The sample rate should be 192000 because "-ar 44100" was not specified
anywhere.
'''ACTUAL RESULT:'''
The sample rate is 44100, which is incorrect.
[[BR]]
[[BR]]
[[BR]]
'''TEST 2: THIS WAV FILE DOES NOT TRIGGER THE BUG'''
'''TEST 2 PASS 1: collect loudness stats'''
{{{
$ /opt/ff/96399-g6e082f9f04/bin/ffmpeg \
-report -v 9 -loglevel 99 \
-i \
ffmpegtest_goodfile2_1m.wav \
-af \
loudnorm=\
I=-13.00:\
TP=-1.00:\
print_format=json \
-f null \
- \
2>&1
}}}
'''TEST 2 PASS 1 FULL RESULTS:'''
[http://substrate.com/ffmpegbug/test2/ffmpeg-20200119-125516.log]
'''TEST 2 PASS 1 JSON object:'''
{{{
{
"input_i" : "-15.92",
"input_tp" : "1.00",
"input_lra" : "5.70",
"input_thresh" : "-25.93",
"output_i" : "-12.84",
"output_tp" : "-1.00",
"output_lra" : "2.70",
"output_thresh" : "-22.84",
"normalization_type" : "dynamic",
"target_offset" : "-0.16"
}
}}}
'''TEST 2 PASS 2: use JSON results from pass 1 to normalize the file'''
'''NOTE THAT -ar IS AGAIN NOT SPECIFIED HERE'''
{{{
$ /opt/ff/96399-g6e082f9f04/bin/ffmpeg \
-report -v 9 -loglevel 99 \
-y \
-i \
ffmpegtest_goodfile2_1m.wav \
-af \
loudnorm=\
I=-13.00:\
TP=-1.00:\
measured_I=-15.92:\
measured_TP=1.00:\
measured_LRA=5.70:\
measured_thresh=-25.93:\
offset=-0.16:\
linear=true:\
print_format=summary \
ffmpegtest_goodfile2_1m_normalized.wav
}}}
'''TEST 2 PASS 2 FULL RESULTS:'''
[http://substrate.com/ffmpegbug/test2/ffmpeg-20200119-125539.log]
'''TEST 2 PASS 2 OUTPUT FILE:'''
[http://substrate.com/ffmpegbug/test2/ffmpegtest_goodfile2_1m_normalized.wav]
'''CONFIRM OUTPUT FILE SAMPLE RATE:'''
{{{
$ soxi ffmpegtest_goodfile2_1m_normalized.wav | grep "Sample Rate"
Sample Rate : 192000
}}}
'''EXPECTED RESULT:'''
The sample rate should be 192000 because "-ar 44100" was not specified
anywhere.
'''ACTUAL RESULT:'''
The sample rate is 192000, as expected.
[[BR]]
[[BR]]
[[BR]]
'''MISC INFO'''
ffmpeg version:
{{{
$ ffmpeg -version
ffmpeg version N-96399-g6e082f9f04-tessus https://evermeet.cx/ffmpeg/
Copyright (c) 2000-2020 the FFmpeg developers
built with Apple clang version 11.0.0 (clang-1100.0.33.16)
configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-
version=tessus --enable-avisynth --enable-fontconfig --enable-gpl
--enable-libaom --enable-libass --enable-libbluray --enable-libdav1d
--enable-libfreetype --enable-libgsm --enable-libmodplug --enable-
libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-
libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-
libopus --enable-librubberband --enable-libshine --enable-libsnappy
--enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-
libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-
libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-
libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-
flags=--static --disable-ffplay
libavutil 56. 38.100 / 56. 38.100
libavcodec 58. 66.100 / 58. 66.100
libavformat 58. 35.103 / 58. 35.103
libavdevice 58. 9.103 / 58. 9.103
libavfilter 7. 71.100 / 7. 71.100
libswscale 5. 6.100 / 5. 6.100
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
}}}
macOS version:
{{{
$ sw_vers -productVersion
10.13.6
}}}
[[BR]]
[[BR]]
[[BR]]
Thanks,
Fred
--
Ticket URL: <https://trac.ffmpeg.org/ticket/8488>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list