I switched encoding from aac to libfdk_aac due to qaulity issues. I noticed with the new encoding a small part of the audio file will be cut in the beginning. I tested this with multiple files. This is the command i am using:

ffmpeg -y -noaccurate_seek -i file.mp3 -b:a 260k -c:a libfdk_aac -vn -movflags +faststart output.m4a

I tried different variations but alway ended up with cut file.

Here is the output of a wave editor

source file:

enter image description here

ouput:

enter image description here

1 Answers

2
Mattias Wadman On Best Solutions

I think i've observed something similar some years ago after switching to fdk-aac but im not sure if it was as much as 25m (suspiciously close to the default granule length for some AAC profiles at 44100hz, 1024/44100 ~= 0.023s). Could it be that the previous aac encoder (ffmpeg native one?) somehow does something different?

Wrote a small script to reproduce but failed to see any difference with audacity. It also tries to decode using libfdk_aac. Hope it might be useful.

alias ffmpeg='docker run --rm -v "$PWD:$PWD" -w "$PWD" mwader/static-ffmpeg:4.1.3'

# test file i used
# ffmpeg -y -f lavfi -i sine -t 1 -ac 2 -ar 44100 sine.wav

# encode with native and fdk aac
ffmpeg -y -i $1 -c:a aac $1.native_aac.mp4
ffmpeg -y -i $1 -c:a libfdk_aac $1.fdk_aac.mp4

# decode native with native and fdk_aac
ffmpeg -y -i $1.native_aac.mp4 $1.native_aac.mp4.native_aac.wav
ffmpeg -y -c:a libfdk_aac -i $1.native_aac.mp4 $1.native_aac.mp4.fdk_aac.wav

# decode fdk_aac with native and fdk_aac
ffmpeg -y -i $1.fdk_aac.mp4 $1.fdk_aac.mp4.native_aac.wav
ffmpeg -y -c:a libfdk_aac -i $1.fdk_aac.mp4 $1.fdk_aac.mp4.fdk_aac.wav