Search code examples
audioffmpegaudio-converter

sound acceleration while converting sound with ffmpeg libfaac


i'm trying to convert sound with ffmpeg using comand:

fmpeg -y -i /Users/Artem/Sites/waprik/testing/orig.mp4 -acodec libfaac -b:a 64k -ar 41000 -ac 2 -threads 0 -vn /Users/Artem/Sites/waprik/public/testing.m4a

original sound is 4:18 min, but output sound duration is 4 minutes and it sounds accelerated. How can i fix it ?

by the way, original sound is

Duration: 00:04:18.81
Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 191 kb/s
    Metadata:
      creation_time   : 2014-03-07 05:45:06
      handler_name    : IsoMedia File Produced by Google, 5-11-2011

Solution

  • you mistyped the audio rate. It should be 44100 instead of 41000:

    ffmpeg -y -i /Users/Artem/Sites/waprik/testing/orig.mp4 -acodec libfaac -b:a 64k -ar 41000 -ac 2 -threads 0 -vn /Users/Artem/Sites/waprik/public/testing.m4a

    Here's the math to prove it! Your initial track is 4 minutes 18 seconds, or 258 seconds. The ratio of your conversion rate to actual rate is 41000/44100, or .9297052. Multiply that ratio by your 258-second track and we end up with a 239.86-second track...or 3 minutes 59.86 seconds.

    What was happening is that you were telling ffmpeg that instead of 44100 frames in a second, there were actually only 41000. So, it grabbed 41000 of the 44100 and called that a second, even though it really wasn't. The result is that you end up with a faster/shorter, slightly degraded audio file.