Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am converting a FLAC file to AAC. I have noticed that the duration is off on the output file. This is even the case if you explicitly set the output duration, it just gets ignored

$ ffmpeg -i foo.flac -t 00:02:52.48 -c:a aac -strict -2 bar.aac
[flac @ 000000000035d960] max_analyze_duration 5000000 reached at 5015510 microseconds

Input #0, flac, from 'foo.flac':
  Duration: 00:02:52.48, bitrate: 446 kb/s
    Stream #0:0: Audio: flac, 44100 Hz, stereo, s16
Output #0, adts, to 'bar.aac':
    Stream #0:0: Audio: aac, 44100 Hz, stereo, fltp, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (flac -> aac)
Press [q] to stop, [?] for help
size=    2770kB time=00:02:52.50 bitrate= 131.5kbits/s
video:0kB audio:2719kB subtitle:0 global headers:0kB muxing overhead 1.867920%


$ ffmpeg -i foo.flac -i bar.aac    
Input #0, flac, from 'foo.flac':
  Duration: 00:02:52.48, bitrate: 446 kb/s
Input #1, aac, from 'bar.aac':
  Duration: 00:02:49.29, bitrate: 134 kb/s

Can I change my command so that the input and output duration match?

share|improve this question
up vote 4 down vote accepted

A 'raw' AAC file contains no information about the file's contents. When you enable all debug info you can see that the time is measured depending on the bitrate when importing aac files:

[aac @ 0xa82ba40] Estimating duration from bitrate, this may be inaccurate

But, when you package your aac file in e.g. a MPEG-4 container, all desired contents are stored in the container. Try encoding your flac audio file to aac and mux it into a .m4a container using these parameters and see what happens if you import the .m4a file again:

ffmpeg -i foo.flac -t 00:02:52.48 -c:a aac -strict -2 bar.m4a

share|improve this answer
.m4a (which is literally an MP4 file under a different name) is customarily used for MP4 files containing only audio, and ffmpeg recognises output.m4a as an MP4 file. +1 though, good answer. – evilsoup Mar 25 '13 at 10:56
Thanks, you're right, I edited my answer to match the right MPEG4 container for only audio. – Nick van Tilborg Mar 25 '13 at 11:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.