Concatenating MP3 Files

Apple requires that you deliver your audiobook as a single, large file, with metadata (in the form of an xml input file) designating the start of each chapter. The audio file is delivered in a <track> tag, with the file being less than 23 hours in length. (For longer audiobooks, you can deliver multiple tracks, and each track can be up to 23 hours long. If a single track audio file is longer than 23 hours, delivery will fail.) The goal is to send the audio in as few tracks as possible, with each track as close to the 23 hour limit as possible.

If your audiobook is currently broken up into multiple MP3 files of short duration, you must concatenate them into a single, longer track (or multiple long tracks, if the combined duration is longer than 23 hours). The required solution for concatenating MP3 files into a single, longer file is provided below.

When concatenating files, you must track the precise cumulative duration of the files. You may choose to round to the nearest second in specifying the chapter marks (see the annotation for Audiobook Track Chaptering in Basic Audiobook Metadata Annotated), but you should use sub-second precision in tracking the cumulative length of the concatenated files; otherwise, your chapter points will gradually become more inaccurate further into the track as the imprecision is compounded.

Important: When concatenating MP3 files, all files must have the same sample rate, bit rate, and channels (for example, mono vs stereo). If the sample rate, bit rate, or channels are different among the tracks, you must force them all to one value using the following arguments:

-ar <sampleRate> -ab <bitRate> -ac <numberOfChannels>

Using the ffmpeg Tool

To concatenate the audio chapters into one long track, you use a command line tool called ffmpeg. It is available for all major operating systems (MacOS, Windows, Linux, etc). You can download ffmpeg here: https://www.ffmpeg.org.

ffmpeg has several ways to concatenate files, but only one method produces the required results. If you are concatenating MP3 files, you must use ffmpeg with the specific arguments and format listed below:

ffmpeg -f concat -safe 0 -i chapter_list.txt -map 0 -map_metadata -1 combined_output.mp3

where chapter_list.txt is a list of all files in the exact form below (this example has 16 chapters; your audiobook might have fewer or more chapters):

file 'chapter_1.mp3'file 'chapter_2.mp3'file 'chapter_3.mp3'file 'chapter_4.mp3'file 'chapter_5.mp3'file 'chapter_6.mp3'file 'chapter_7.mp3'file 'chapter_8.mp3'file 'chapter_9.mp3'file 'chapter_10.mp3'file 'chapter_11.mp3'file 'chapter_12.mp3'file 'chapter_13.mp3'file 'chapter_14.mp3'file 'chapter_15.mp3'file 'chapter_16.mp3'

Important: You must use ffmpeg with the specific arguments as shown above. Other similar tools and similar arguments will produce suboptimal results.