I am trying to concatenate two m4a (aac) files using the FFmpeg with the following command:
ffmpeg -f concat -i input.txt -codec copy output.m4a
the first file number of frames using afinfo on macOS:
File type ID: m4af
Data format: 1 ch, 44100 Hz, 'aac ' (0x00000000) 0 bits/channel, 0 bytes/packet, 1024 frames/packet, 0 bytes/frame
no channel layout.
estimated duration: 8.473832 sec
audio bytes: 68931
audio packets: 367
bit rate: 64710 bits per second
packet size upper bound: 391
maximum packet size: 391
audio data file offset: 44
not optimized
audio 373696 valid frames + 2112 priming + 0 remainder = 375808
format list:
[ 0] format: 1 ch, 44100 Hz, 'aac ' (0x00000000) 0 bits/channel, 0 bytes/packet, 1024 frames/packet, 0 bytes/frame
Channel layout: Mono
The second file metadata:
File type ID: m4af
Num Tracks: 1
Data format: 1 ch, 44100 Hz, 'aac ' (0x00000000) 0 bits/channel, 0 bytes/packet, 1024 frames/packet, 0 bytes/frame
no channel layout.
estimated duration: 5.594558 sec
audio bytes: 46077
audio packets: 243
bit rate: 65329 bits per second
packet size upper bound: 340
maximum packet size: 340
audio data file offset: 44
not optimized
audio 246720 valid frames + 2112 priming + 0 remainder = 248832
format list:
[ 0] format: 1 ch, 44100 Hz, 'aac ' (0x00000000) 0 bits/channel, 0 bytes/packet, 1024 frames/packet, 0 bytes/frame
Channel layout: Mono
the resulted audio files metadate:
File type ID: m4af
Num Tracks: 1
Data format: 1 ch, 44100 Hz, 'aac ' (0x00000000) 0 bits/channel, 0 bytes/packet, 1024 frames/packet, 0 bytes/frame
no channel layout.
estimated duration: 14.070998 sec
audio bytes: 122792
audio packets: 607
bit rate: 69696 bits per second
packet size upper bound: 293
maximum packet size: 293
audio data file offset: 40
not optimized
audio 620531 valid frames + 1024 priming + 13 remainder = 621568
format list:
[ 0] format: 1 ch, 44100 Hz, 'aac ' (0x00000000) 0 bits/channel, 0 bytes/packet, 1024 frames/packet, 0 bytes/frame
Channel layout: Mono
The problem is that the total number of frames should be 367+293 = 610 and the resulted number of frames is 607. And the duration is 14.070998 sec instead of 14.06839 sec
Any ideas if I am doing anything wrong here? I need to precisely concatenate the two files without any loss or gain in the input frames.
User contributions licensed under CC BY-SA 3.0