#2759 closed defect (invalid)
Audio equalizer filter problem - clipping with negative gain
Reported by: | Alex-Frst | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | git-master | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
How to reproduce:
% ffmpeg -f lavfi -i aevalsrc="1.98*random(0)-0.99" -to 60 noise.wav ... % ffmpeg -i noise.wav -af equalizer=2000:q:1:-5 noise2.wav ffmpeg version N-54499-g63d7684 Copyright (c) 2000-2013 the FFmpeg developers built on Jul 6 2013 10:35:18 with gcc 4.7.3 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enab le-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgs m --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libope njpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable- libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs -- enable-libxvid --enable-zlib libavutil 52. 38.100 / 52. 38.100 libavcodec 55. 18.102 / 55. 18.102 libavformat 55. 11.101 / 55. 11.101 libavdevice 55. 2.100 / 55. 2.100 libavfilter 3. 78.102 / 3. 78.102 libswscale 2. 3.100 / 2. 3.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 3.100 / 52. 3.100 Guessed Channel Layout for Input Stream #0.0 : mono Input #0, wav, from 'noise.wav': Metadata: encoder : Lavf55.11.101 Duration: 00:01:00.00, bitrate: 705 kb/s Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s Output #0, wav, to 'noise2.wav': Metadata: ISFT : Lavf55.11.101 Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s Stream mapping: Stream #0:0 -> #0:0 (pcm_s16le -> pcm_s16le) Press [q] to stop, [?] for help clipping Last message repeated 654 times clipping 120kB time=00:00:01.39 bitrate= 706.1kbits/s Last message repeated 651 times clipping 236kB time=00:00:02.73 bitrate= 705.8kbits/s Last message repeated 653 times clipping 352kB time=00:00:04.08 bitrate= 705.8kbits/s Last message repeated 662 times clipping 476kB time=00:00:05.52 bitrate= 705.7kbits/s Last message repeated 653 times clipping 604kB time=00:00:07.01 bitrate= 705.7kbits/s Last message repeated 649 times clipping 720kB time=00:00:08.35 bitrate= 705.7kbits/s Last message repeated 654 times clipping 848kB time=00:00:09.84 bitrate= 705.7kbits/s Last message repeated 672 times .....
Change History (6)
comment:1 by , 12 years ago
Component: | FFmpeg → undetermined |
---|
comment:2 by , 12 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:3 by , 12 years ago
How can equalizing with negative gain (-5dB in the example) at some frequency cause clipping (or message about clipping)?
% ffmpeg -i noise.wav -filter:a "astats" -vn -f null NUL .... [Parsed_astats_0 @ 000000000263ac60] Overall [Parsed_astats_0 @ 000000000263ac60] DC offset: 0.000367 [Parsed_astats_0 @ 000000000263ac60] Min level: -0.989990 [Parsed_astats_0 @ 000000000263ac60] Max level: 0.989990
After equalizing:
% ffmpeg -i noise2.wav -filter:a "astats" -vn -f null NUL .... [Parsed_astats_0 @ 000000000036ac60] Overall [Parsed_astats_0 @ 000000000036ac60] DC offset: 0.000367 [Parsed_astats_0 @ 000000000036ac60] Min level: -0.989990 [Parsed_astats_0 @ 000000000036ac60] Max level: 0.989990
Where is clipping?
comment:4 by , 12 years ago
Obvious clipping is in source, as its not normalized (between -1 and 1). Thank you very much for wasting my time on this instead of working on among others, new filter(s).
comment:5 by , 12 years ago
Yes, it not normalaized (-0.989990...0.989990). But problem is not in source. With +0.1dB gain there is no any messages:
% ffmpeg -i noise.wav -af equalizer=2000:q:1:0.1 noise3.wav ... Guessed Channel Layout for Input Stream #0.0 : mono Input #0, wav, from 'noise.wav': Metadata: encoder : Lavf55.11.100 Duration: 00:01:00.00, bitrate: 705 kb/s Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s Output #0, wav, to 'noise2.wav': Metadata: ISFT : Lavf55.11.100 Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s Stream mapping: Stream #0:0 -> #0:0 (pcm_s16le -> pcm_s16le) Press [q] to stop, [?] for help size= 5168kB time=00:01:00.00 bitrate= 705.6kbits/s video:0kB audio:5168kB subtitle:0 global headers:0kB muxing overhead 0.001512%
Stats after +0.1dB:
% ffmpeg -i noise3.wav -filter:a "astats" -vn -f null NUL ... [Parsed_astats_0 @ 00000000026486c0] Overall [Parsed_astats_0 @ 00000000026486c0] DC offset: 0.000367 [Parsed_astats_0 @ 00000000026486c0] Min level: -0.997406 [Parsed_astats_0 @ 00000000026486c0] Max level: 0.997650
All OK. It's -0.997406..0.997650 now, little gain and no clipping messages.
Let's test normilized sourse:
% sox noise.wav noise4.wav norm ... % ffmpeg -i noise4.wav -filter:a "astats" -vn -f null NUL ... [Parsed_astats_0 @ 00000000024e86c0] Overall [Parsed_astats_0 @ 00000000024e86c0] DC offset: 0.000371 [Parsed_astats_0 @ 00000000024e86c0] Min level: -1.000000 [Parsed_astats_0 @ 00000000024e86c0] Max level: 0.999969 % ffmpeg -i noise4.wav -af equalizer=2000:q:1:-5 -y noise5.wav .... Guessed Channel Layout for Input Stream #0.0 : mono Input #0, wav, from 'noise4.wav': Duration: 00:01:00.00, bitrate: 705 kb/s Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s Output #0, wav, to 'noise5.wav': Metadata: ISFT : Lavf55.11.100 Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s Stream mapping: Stream #0:0 -> #0:0 (pcm_s16le -> pcm_s16le) Press [q] to stop, [?] for help clipping Last message repeated 679 times clipping 100kB time=00:00:01.16 bitrate= 706.2kbits/s Last message repeated 643 times clipping 196kB time=00:00:02.27 bitrate= 705.9kbits/s Last message repeated 651 times ....
clipping again.
comment:6 by , 12 years ago
Looks like it's because of equalizing algorithm, dither or something else... Sox clipping with this parameters too. I was confised by "Beware of clipping when using a positive gain" in documentation.
Closed. No more wasting your time.
It is obvious that your command cause clipping, as its wrong.