ffmpeg flac or mp3 to m4a - exactly the same length possible?

I'm converting .flac and .mp3 audio files to .m4a using ffmpeg with libfdk_aac (Fraunhofer AAC encoder) like this:

ffmpeg -i "001.flac" -c:a libfdk_aac "001.m4a"

This works fine, but in case of .flac the resulting .m4a files include ~0.046 seconds of silence at the start and sometimes a few extra milliseconds at the end. Though, I need the .m4a files to be of exactly(!) the same length without any extra silence. Is there a way to achieve this? (At the moment I'm using an additional step, i.e. cutting the resulting .m4a file.)

1 answer

  • answered 2021-02-16 17:49 szatmary

    No, it’s not possible. The different codecs use different frame sizes.