Mostly automated way to merge audiobooks (or podcasts) without quality loss from reencoding (remuxing only) to either single file m4b files with quicktime/nero chapters or single file mp3s with id3v2 chapters using cuesheets
Windows is required to run bat scripts, but python and ruby scripts should work on linux/macOS
These merged audiobooks were meant to be used with Prologue iOS app, it's awesome so check it out!
1. Add m4b files to bin folder of ffmpeg (4.4 plus)
2. Import tracks into mp3tag
3. Edit "title" fields as desired (full chapter names will take longer than simple Chapter 01)
- Ensure track number is filled and in order (can use mp3tag > tools > auto number wizard)
- Ensure the Artist field is not empty
- Ensure the Album field contains no characters not allowed in a filename (?, :, etc)
4. Select all, right click > export > txt_taglist > Okay to create list.txt file
- If this is first time, you will need to first edit "txt_taglist" and replace current text with below and save changes
$filename(txt,utf-8)$loop(%_path%)%track%. "%title%" $div(%_length_seconds%,60)':'$num($mod(%_length_seconds%,60),2)
$loopend()
5. Run m4b_merge-files.bat
- will merge m4b files to a single input.mp4 file (make sure tracks are in proper order by filename)
6. Use "m4b_list2cue.bat"
- will generate a .cue file
7. Run m4b_add-chapters.bat
- will add chapters then convert fmpeg embedded chapters to proper m4b quicktime format
- will also attempt to rename and move output into its own folder based on album field
1. Add mp3 files to bin folder of ffmpeg (4.4 plus)
2. Import tracks into mp3tag
3. Edit "title" fields as desired (full chapter names will take longer than simple Chapter 01)
- Ensure Tracknumber fields are filled with integers (can use mp3tag > tools > auto number wizard)
- Ensure the Artist field is not empty
- Ensure the Album field contains no characters not allowed in a filename (?, :, etc)
4. Select all, right click > export > txt_taglist > Okay to create list.txt file
- If this is first time, you will need to first edit "txt_taglist" and replace current text with below and save changes
$filename(txt,utf-8)$loop(%_path%)%track%. "%title%" $div(%_length_seconds%,60)':'$num($mod(%_length_seconds%,60),2)
$loopend()
5. Run mp3_merge-files.bat
- will merge mp3 files to a single input.mp3 file (ensure tracks are in proper order by filename)
6. Use "mp3_list2cue.bat"
- will generate a .cue file
7. Run mp3_add-chapters.bat
- will add chapters in id3v2.3 format
- will also attempt to rename and move output into its own folder based on album field
1. Add mp3 files to bin folder of ffmpeg (4.4 plus)
2. Run mp3_merge-files.bat
- will merge mp3 files to a single input.mp3 file (ensure tracks are in proper order by filename)
3. Drag merged input.mp3 into mp3directcut
4. Go to special > pause detection, try -44.5 dB, 2.9 s, -6 frames as a starting point
5. Wait for it to detect chapter breaks, click close once it no longer says "stop"
6. Check detected chapters with the >| dotted line button
- If undercounts chapters, repeat step 4 with lower seconds or manually find chapters to add
- Note c creates a chapter but only if start and end point of selection are the same
- this can be done quickly at position by hitting b, n, c
- If it overcounts by a lot, repeat step 4 with higher seconds
- Incorrect chapters can be deleted by selecting section, special > remove edit break
- It is helpful to cross references number of chapters with numbers of pauses using epub
7. File > Save as cuesheet.cue
8. Open up .cue file in text editor and change TITLES as desired for each chapter
9. Run mp3_add-chapters.bat
- will add chapters in id3v2.3 format
- will also attempt to rename and move output into its own folder based on album field
0. Since mp3directcut doesn't support m4b we will make a *temporary* reencode to generate the .cue
1. Add m4b files to bin folder of ffmpeg (4.4 plus)
2. Run m4b_merge-files.bat
- will merge m4b files to a single input.mp4 file (ensure tracks are in proper order by filename)
- Remove old m4b files from the directory
3. Run m4b_reencode.bat
- will rename the m4b file (if needed) to input.mp4 and reencode it to output.mp3
4. Drag reencoded mp3 file into mp3directcut
5. Go to special > pause detection, Try -44.5 dB, 2.9 s, -6 frames as starting point
6. Wait for it to detect chapter breaks, click close once it no longer says "stop"
7. Check detected chapters with the >| dotted line button
- If undercounts chapters, repeat step 4 with lower seconds or manually find chapters to add
- Note c creates a chapter but only if start and end point of selection are the same
- this can be done quickly at position by hitting b, n, c
- If it overcounts by a lot, repeat step 4 with higher seconds
- Incorrect chapters can be deleted by selecting section, special > remove edit break
- It is helpful to cross references number of chapters with numbers of pauses using epub
8. File > Save as cuesheet.cue
9. Open up .cue file in text editor and change TITLES as desired for each chapter
10. Once satisfied with your .cue, delete reencoded output.mp4
11. Run mp4_add-chapters.bat
- will add chapters then convert fmpeg embedded chapters to proper m4b quicktime format
- will also attempt to rename and move output into its own folder based on album field
1. change the names of the two m4b files to be merged to input1.mp4 and input2.mp4
2. Run m4b_merge-chapterized.bat, which will merge the two files
- will combine chapters then convert fmpeg embedded chapters to proper m4b quicktime format
- will also remove extraneous video streams caused by embedded covers
3. Can check with ffmpeg -i *.m4b or MediaInfo to ensure chapters are present
4. If there is more than two m4b files, repeat steps for each additional part
Export to Cue Sheet:
1. Add the file to bin folder of ffmpeg (4.4 plus)
2. Rename the file to export.mp3 or export.m4b
3. Run mp3_export-cue.bat (or m4b)
4. Open cuesheet.cue and edit the chapter titles as desired
5. Rename to input.mp3 (or m4b)
6. Run mp3_add-chapter.bat (or m4b)
- will add chapters in respective format
- will also attempt to rename and move output into its own folder based on album field
Alternatively, you can export to Metadata:
1. Add the file to bin folder of ffmpeg (4.4 plus)
2. Rename the file to export.mp3 or export.m4b
3. Run mp3_export-metadata.bat or m4b_export-metadata.bat
4. Open metadata.txt and edit the chapter titles as desired
5. Rename the file to input.mp3 or input.mp4
6. Run mp3_mergemetadata.bat or mp4_merge-metadata.bat
- will overwrite existing chapters with edited chapters
- will also attempt to rename and move output into its own folder based on album field
ffmpeg -i file.ext OR ffprobe file.ext