[FFmpeg-user] AAC encoding seems to shorten the file slightly

Will Munn will.munn at focusrite.com
Fri Apr 20 15:12:36 EEST 2018


Hi,

We have a script that creates AAC versions of WAV samples to be used in a musical context (looped stretched etc). Currently we are using apples encoder (afconvert) to do this on a Mac. We’d like to be able to move to ffmpeg so that we can run this without requiring OSX.

I have written a test which does the conversion using ffmpeg instead of afconvert. However I am finding that ffmpeg is truncating the audio slightly.

Using the same source wav file for example I ran:

ffmpeg -y -I source.wav -b:a 128k ffmpeg.m4a

And with afconvert:

afconvert source.wav -o afconvert.m4a -q 127 -b 128000 -f m4af -d aac

When you compare the 2 audio files with ffprobe for example you can see that the duration is smaller on the ffmpeg encoded file. Are you aware of this and is there a way around it?

Thanks for any help/advice you may have!

Will

ffprobe -i Bip\ late\ bip.wav-afconvert.m4a -hide_banner -show_format
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Bip late bip.wav-afconvert.m4a':
  Metadata:
    major_brand     : M4A
    minor_version   : 0
    compatible_brands: M4A mp42isom
    creation_time   : 2018-04-19T14:59:57.000000Z
    iTunSMPB        :  00000000 00000840 000002B0 000000000002B110 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  Duration: 00:00:04.06, start: 0.047891, bitrate: 14 kb/s
    Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 6 kb/s (default)
    Metadata:
      creation_time   : 2018-04-19T14:59:57.000000Z
[FORMAT]
filename=Bip late bip.wav-afconvert.m4a
nb_streams=1
nb_programs=0
format_name=mov,mp4,m4a,3gp,3g2,mj2
format_long_name=QuickTime / MOV
start_time=0.047891
duration=4.063492
size=7523
bit_rate=14810
probe_score=100
TAG:major_brand=M4A
TAG:minor_version=0
TAG:compatible_brands=M4A mp42isom
TAG:creation_time=2018-04-19T14:59:57.000000Z
TAG:iTunSMPB= 00000000 00000840 000002B0 000000000002B110 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[/FORMAT]

ffprobe -i Bip\ late\ bip.wav.ffmpeg.m4a -hide_banner -show_format
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Bip late bip.wav.ffmpeg.m4a':
  Metadata:
    major_brand     : M4A
    minor_version   : 512
    compatible_brands: isomiso2
    encoder         : Lavf57.83.100
  Duration: 00:00:04.02, start: 0.000000, bitrate: 12 kb/s
    Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 9 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[FORMAT]
filename=Bip late bip.wav.ffmpeg.m4a
nb_streams=1
nb_programs=0
format_name=mov,mp4,m4a,3gp,3g2,mj2
format_long_name=QuickTime / MOV
start_time=0.000000
duration=4.024000
size=6230
bit_rate=12385
probe_score=100
TAG:major_brand=M4A
TAG:minor_version=512
TAG:compatible_brands=isomiso2
TAG:encoder=Lavf57.83.100
[/FORMAT]


More information about the ffmpeg-user mailing list