DEV Community

AlexMaryW
AlexMaryW

Posted on

How to Split Audiobooks into Chapters for Free Using Chapterize-Audiobooks?

If you’re tired of dealing with large MP3 files and want to learn how to split audiobooks into chapters for free, this step-by-step guide will show you how to use Chapterize-Audiobooks effectively.

If you've ever purchased an audiobook only to find one huge mp3 file, you know how frustrating it can be. I’ve been there. Every time I restarted the app, I’d be thrown back to the beginning, struggling to find my place. It was such a headache that I eventually gave up on the book altogether.

Fortunately, there's a solution to this headache - Chapterize-Audiobooks! This open-source audiobook splitter available on GitHub allows you to easily convert one large MP3 file into chapterized MP3s. As a beginner, I faced some challenges while installing it, but with this tutorial, you’ll be able to split your audiobooks with ease.

Chapterize-Audiobooks is an open-source program with a command line interface that can split one big MP3 audiobook file into easy-to-navigate chapterized MP3s. Because this program is open source, it's available for free. Command line interface, on the other hand, means that you need to write instructions for the program in the terminal (Command Prompt application on Windows). Your instructions will have to follow a special syntax so that the software can understand and execute them.

Don't worry if you’re unfamiliar with these terms! This tutorial will walk you through the process step-by-step so you can effortlessly split your audiobooks into chapters.


How to Install Python, Git, and FFmpeg for Splitting Audiobooks

To use Chapterize-Adiobooks, you will need to install three things on your computer:

  • a programming language called Python;
  • a tool for managing code called Git;
  • and an audio processing tool called ffmpeg.

Let's begin with Python because it's the easiest one to install.

  1. Open the terminal on your computer (Command Prompt application on Windows). The first thing you'll see in your terminal is a prompt* and it will look like this: C:\Users\your-username>. To check if Python is installed on your computer, type/copy the following line into your terminal and hit enter:

    python --version
    

    This line is a great example of the syntax you need to use to execute a program in the terminal. Usually, the program's name comes first and, then, your chosen options/parameters separated by spaces.

  2. If Python is already set up on your computer, the terminal will display its version (e.g. Python 3.12.6) and you can move to installing Git.

  3. If you don't have Python on your computer, Windows 10 will open Microsoft Store for you. There, you can download and install Python free of charge. When the installation's complete, type/copy the following line into your terminal and hit enter:

    python --version
    
  4. If the terminal displays Python's version (e.g. Python 3.12.6), the installation has been successful.

Now that we have Python, let's install Git.

  1. You can get the Git installer for free from Git's official website.
  2. When the download is finished, click on the file, and go through the installation process (you can safely keep clicking "Next" until the "Install" button appears).
  3. Once Git is installed, restart your terminal before moving forward with this tutorial.

Two done, one to go! Here's how you install ffmpeg.

  1. Download the zip file with source code for ffmpeg by clicking here.
  2. Unpack the file. To do this you can use 7zip program or WinRAR.
  3. Rename the unpacked folder to "ffmpeg".
  4. Move the "ffmpeg" folder to your C drive. To find your C drive, you can type into your computer search bar "This PC", click it, and find "Windows (C:)" in the "Devices and drives" section.
  5. Search for the Command Prompt application, right-click it, and select "Run as administrator" from the drop down menu.
  6. When the terminal opens, your prompt should look like this: C:\WINDOWS\system32>.
  7. Now we need to add ffmpeg's installation folder to the system's PATH so that Windows knows where to find ffmpeg when it's needed. To do that, type/copy the following line into your terminal and hit enter:

    setx /m PATH "C:\ffmpeg\bin;%PATH%"
    
  8. If you were successful, the terminal will display the following message: "SUCCESS: Specified value was saved". To proceed, you need to restart your computer.

  9. When your computer restarts, you can double-check if ffmpeg is set up. To do so, run Command Prompt app as an administrator, type/copy the following line into your command line, and hit enter:

    ffmpeg -version
    
  10. If the installation was successful, the terminal will display ffmpeg's version, configuration, and libraries.

Great job! You're all set up to install Chapterize-Audiobooks!

*The prompt will reappear at the beginning of new line in your terminal when your computer has executed your command. For the sake of brevity, the prompt is omitted in the command lines in this tutorial. The prompt will no longer reappear when we start using Chapterize-Audiobooks.


How to Install Chapterize-Audiobooks

  1. To install Chapterize-Audiobooks, you need to download the program from GitHub. Type/copy the following line into your terminal and hit enter:

    git clone https://github.com/patrickenfuego/Chapterize-Audiobooks.git
    

    This line copies the program's code from GitHub to your computer and you can use it to download any open source program. Please make sure to copy the correct GitHub link into your command.

  2. When the prompt reappears in the terminal, it means the download was successful and we can proceed by going into the program's folder. Type/copy the following line into your terminal and hit enter:

    cd Chapterize-Audiobooks
    
  3. When the prompt reappears in this form: C:\Users\your-username\Chapterize-Audiobooks>, it means you have entered the correct folder on your computer. The next step is installing libraries necessary for Chapterize-Audiobooks to run correctly (listed in the "requirements.txt" file). A program called Pip* will handle this process by reading the file and installing the libraries included in it. To complete this step, type/copy the following line into your terminal and hit enter:

    pip install -r requirements.txt
    

Congratulations! You have installed Chapterize-Audiobooks and are ready to split your audiobooks!

*Pip is installed together with Python so it's already set up on your computer.


How to Use Command Line to Split Audiobooks

  1. Whenever you'd like to split an audiobook using Chapterize-Audiobooks, you need to first go into the program's folder. You can do this by typing/copying the following line into your terminal and hitting enter (if you have just installed the program, you're already in the correct folder and can move to step 3):

    cd Chapterize-Audiobooks
    
  2. When the prompt reappears in the following form: C:\Users\your-username\Chapterize-Audiobooks>, it means you have entered the folder and are ready to split your audiobook.

  3. To split an audiobook, we need the audiobooks's file path, its location on your computer. The program will split your audiobook faster if the file is saved on your computer rather than on a peripheral device like a USB, memory card, etc. Although Windows doesn't provide the file path, here's how you can put it together:

    • Right-click your audiobook's folder, choose "Properties", and copy the address shown in the "Location" section.
    • Add your audiobook file's name with ".mp3" at the end of the file path, e.g. C:\Users\your-username\Desktop\audiobook\audiobook.mp3.
    • If your audiobook's name contains spaces, replace them with hyphens (e.g. my-audiobook.mp3), or the terminal will misinterpret them.
  4. Now, you're all set to split the audiobook. To use the Chapterize-Audiobooks program, your command line will have to include python (tells the terminal to use Python to run the program), chapterize_ab.py (the program file), and the audiobook's file path in single quotation marks (use the quotation marks, to avoid issues if your file path contains spaces). To split the audiobook, type the following line into your terminal, paste your file path, and hit enter:

      python chapterize_ab.py 'C:\Users\your-username\Desktop\audiobook\audiobook.mp3'
    
  5. Now, the program will do its magic and split your monolithic MP3 into chapterized MP3 files. Please be patient with this process because the longer your audiobook, the longer the program will take to chapterize it (it might take an hour or more in certain cases).


How to Add Titles, Cover Art, etc., with Chapterize-Audiobooks

Chapterize-Audiobooks can do more than just split your audiobook. You can, for example, ask it to give your audiobook a title, add a cover art, or author's name. All available parameters can be found in the Usage and Examples sections of Chapterize-Audiobooks's readme.

The parameters in square brackets are optional and parameters in curly brackets are available options to choose from. You can add as many as you like and in an order that suits you by typing them together with the command line splitting the audiobook. For example, typing the following line and hitting enter will split an audiobook, add cover art to it, and the author's name:

python chapterize_ab.py 'your audiobook path' --title 'your audiobook's title' --cover_art 'path to the cover art' --author 'author's name'
Enter fullscreen mode Exit fullscreen mode

Was this guide helpful? Do let me know in the comments and enjoy your chapterized audiobooks! 😃

Top comments (0)