This Python script concatenates multiple MP3 files within each subdirectory of a given directory, preserving the ID3 tags, including cover art, from the first file in each subdirectory. It is designed to handle special characters in file names and ensures the correct order of files based on natural sorting.
- Concatenates MP3 files in each subdirectory.
- Preserves ID3 tags, including cover art.
- Handles special characters in file paths.
- Ensures natural sorting order of files (e.g., 1, 2, ... 10, 11, ...).
Before running this script, ensure you have the following installed:
- Python 3
- FFmpeg
- Mutagen (Python library)
- Clone the repository:
git clone https://github.com/dursch/audiobook-joiner.git
- Install Mutagen:
pip install mutagen
- Ensure FFmpeg is installed and accessible in your system's PATH.
-
Place the script in a directory containing subdirectories with MP3 files.
-
Open a terminal and navigate to the script's directory.
-
Run the script:
python mp3joiner.py
- The script will process each subdirectory, concatenating MP3 files, preserving ID3 tags from the first file, and saving the output in the specified root directory.
-
Special Character Handling: The script attempts to handle special characters in file paths, but certain unique cases might cause issues. If you encounter problems, check the file names for unusual characters.
-
Order of Files: The script uses natural sorting, but if your file naming convention is unusual, you might need to adjust the sorting function.
-
ID3 Tags Limitation: The script currently transfers ID3 tags from the first file in the directory. If you require a different method for selecting which file's tags to preserve, additional modifications to the script are needed.