'FFMPEG: Automatically remove audio codec latency

I am using FFMPEG to apply several audio codecs to a large number of speech files. Each codec introduces a different latency and I could not find a description of the precise value of this delay. However, for an investigation I need to correct this delay, i.e. adjust the audio after coding such that it is time aligned with the original, uncoded audio. At the moment I use cross-correlation to figure out the actual latency introduced by the codecs which is working fine, but it feels slightly unreliable. Is there some way to a) remove the delay automatically or b) to exactly know the delay of the codecs? Thank you!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source