dcshift¶
This filter applies a DC shift to the audio. (See Direct current, and DC bios.)
This can be useful to remove a DC offset (caused perhaps by a hardware problem in the recording chain) from the audio. The effect of a DC offset is reduced headroom and hence volume. The astats filter can be used to determine if a signal has a DC offset.
I don’t have any problematic audio that would be covered by this filter, so, the following examples are artificially created.
[me@host: ~]$ ifn="/path/to/some.mp3"
[me@host: ~]$ ffprobe -f lavfi "amovie=${ifn},astats=metadata=1" 2>&1 | \
> sed '/Overall/,$!d' | grep DC
[Parsed_astats_1 @ 00000000005337c0] DC offset: 0.019078
[me@host: ~]$ ffmpeg -y -i "${ifn}" -af "dcshift=-0.019078" out.mp3
...
[me@host: ~]$ ffprobe -f lavfi "amovie=out.mp3,astats=metadata=1" 2>&1 | \
> sed '/Overall/,$!d' | grep DC
[Parsed_astats_1 @ 00000000004a6aa0] DC offset: 0.000006
[me@host: ~]$ # you can specify "limitergain" like this:
[me@host: ~]$ # ffmpeg -y -i "${ifn}" -af "dcshift=-0.01:limitergain=0.02" out.mp3