Quote:Adjusting audio delay from 0 by 43 to -43 due to encoder compensation.This happens if you encode to aac.
Quote:So why is the encoder adding this delay of -43ms? And why is it often (always?) -43ms?Different encoders use different sample lenght depending on the channel count, the aac profile and sample rate.
Also deplay is differently compensated by different containers (mp4/mkv) and muxers.
There should be a few discussions about the aac delay over at doom9s and gleitz (german) forum.
I collected all the infos and wrote some code for it ~9 years ago.
If you are interessted I can share the ~200 lines of code which Hybrid uses since then.
I posted a simplified version 7 years ago over at videohelp:
if (heaac) { //HE-AAC
if (nero) {
encoderDelay = int(2336 * 2000 / audioOutputSampleRate.toDouble() + 0.5);
} else if (qaac) {
encoderDelay = int(2585 * 2000 / audioOutputSampleRate.toDouble() + 0.5);
mkvDelayFix = encoderDelay;
mkvDelayFix -= int(2112 * 1000 / audioOutputSampleRate.toDouble() + 0.5);
} else if (fhg) {
encoderDelay = int(794 * 2000 / audioOutputSampleRate.toDouble() + 0.5);
}
} else if (heaacv2) { //HE-AAC V2
if (nero) {
encoderDelay = int(2808 * 2000 / audioOutputSampleRate.toDouble() + 0.5);
} else if (qaac) {
encoderDelay = int(2585 * 2000 / audioOutputSampleRate.toDouble() + 0.5);
mkvDelayFix = encoderDelay;
mkvDelayFix -= int(2112 * 1000 / audioOutputSampleRate.toDouble() + 0.5);
} else if (fhg) {
encoderDelay = int(794 * 2000 / audioOutputSampleRate.toDouble() + 0.5);
} else { //faac/fdk/...
encoderDelay = int(2048 * 1000 / audioOutputSampleRate.toDouble() + 0.5);
}
} else { //AAC LC
if (nero) {
encoderDelay = int(2624 * 1000 / audioOutputSampleRate.toDouble() + 0.5);
} else if (qaac) {
encoderDelay = int(2112 * 1000 / audioOutputSampleRate.toDouble() + 0.5);
} else if (fhg) {
encoderDelay = int(1600 * 1000 / audioOutputSampleRate.toDouble() + 0.5);
} else { //faac/fdk/..
encoderDelay = int(2048 * 1000 / audioOutputSampleRate.toDouble() + 0.5);
}
}
delay = QString::number(inputDelay - encoderDelay);
Side note: That code does not take into consideration that fdk and fhg use different sampleSizes depending on the channel count and how Hybrid would modify the result depending on the used muxer, but it shows the general complexity of the calculation.
-> Since the channel count (usually 2 or 6), the sample rate (usually 48 000Hz) is often the same the delay modifier also often is the same.
Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.