Opened 3 months ago
Last modified 2 months ago
#11138 new defect
FFmpeg audio dither creates unwanted DC offset
Reported by: | mstgrv | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | swresample |
Version: | 7.0 | Keywords: | dither |
Cc: | MasterQuestionable | Blocked By: | |
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
I ran a test of FFmpeg's audio dithering and I noticed that it creates a DC offset in the resulting audio file, which shouldn't be there. Doing the same dithering process with other tools produces no DC offset in the resulting audio.
Here's what I did:
- Create a silent WAV file (44.1khz, 32-bit floating point) using iZotope RX.
- Convert that file to 16-bit with triangular dither, using iZotope RX
- Convert the same file to 16-bit with triangular dither, using FFmpeg. The command I used was:
ffmpeg -i input.wav -c:a pcm_s16le -dither_method triangular output.wav
Because the file in step 1 is completely silent, the files created in steps 2 & 3 contain just the dither by itself.
FFmpeg's conversion results in a file with DC offset, but iZotope RX's conversion has none. The expected result is no DC offset.
I have attached all the WAV files, plus screenshots of the analysis of each file (using iZotope RX) which shows the DC offset result.
Attachments (6)
Change History (9)
by , 3 months ago
Attachment: | silence 44-32.png added |
---|
by , 3 months ago
Attachment: | ffmpeg.png added |
---|
by , 3 months ago
by , 3 months ago
Attachment: | audio files.zip added |
---|
comment:2 by , 3 months ago
Paul that worked on this moved to his own fork of ffmpeg. Open the issue there.
comment:3 by , 2 months ago
Cc: | added |
---|---|
Component: | undetermined → swresample |
Keywords: | dither added; audio dithering removed |
͏ Did.
͏ Potential rounding error of "swresample"
͏ https://github.com/librempeg/librempeg/issues/11
͏ ----
͏ "-dither_method triangular"
͏ Does it happen with other methods?
͏ Or the default..?? 0?
A similar bug existed in Reaper, which was fixed in 2021 https://forum.cockos.com/showpost.php?p=2425940&postcount=25
The developer clarified what the issue was and how it was fixed https://forum.cockos.com/showpost.php?p=2801990&postcount=33
Perhaps this could be the fix for the issue in FFmpeg?