M4Baker is an excellent application for Linux that lets users take audio tracks of any format and encode them into a nice chaptered audiobook file for playback within audiobook players on Linux (and elsewhere) that support the M4B format.
In this guide, we’ll go over how to take audiobook files, encode them into the M4B audiobook format and create audio books on Linux.
Note: you do not have to record your audiobook to use M4B. It is possible to take existing audio tracks and compile them into an audiobook. You can download free, public-domain audio files on Archive.org.
The M4Baker app has been around for a while. Despite its age, many distributions do not carry it in their software sources.
For this reason, we’ll be building the program from its source code. However, before compiling anything, some dependencies need to be installed. These dependencies are critical to the process and help the M4Baker source code compile on your machine.
Dependencies for M4Baker are Python 2.6+, PyQT 4.6, Qt 4.5+, FAAC 1.26+, Sox 14.3+, and Mp4v2 1.9. Follow the instructions below and learn how to get these dependencies working on your Linux operating system of choice.
Note: Arch Linux users can build M4Baker from source automatically thanks to the Arch Linux AUR. Point your favorite AUR helper to the m4baker-git package to get it working.
sudo apt install git python-qt4 libcanberra-gtk-module faac libmp4v2-2 mp4v2-utils sox libsox-fmt-mp3
sudo apt-get install git faaclibcanberra-gtk-module faac libmp4v2-2 mp4v2-utils sox libsox-fmt-mp3
sudo dnf install git PyQT4 python2 faac libmp4v2-devel libmp4v2 libcanberra sox qt-devel sudo dnf install https://download1.rpmfusion.org/free/fedora/releases/26/Everything/x86_64/os/Packages/s/sox-plugins-freeworld-14.4.2-1.fc25.x86_64.rpm -y
sudo zypper install git python2-qt4 python libcanberra-gtk-module-common faac libmp4v2-devel libqt4-devel
Note: OpenSUSE doesn’t have the MP3 plugin for Sox in their repositories. As a result, you will need to compile and install Sox by hand to use it. Head over to the Sox GitHub page and download the source-code here. Instructions to build the software on Linux are located in README.sh.
Download source code
With the M4Baker libraries taken care of, it’s time to download the source code. In a terminal, use the git clone command.
git clone https://github.com/crabmanX/m4baker
Move your terminal window into the new m4baker code folder with the CD command.
The compilation and setup process for M4Baker is refreshingly simple, compared to a lot of other programs Linux users build from source. To get it running, you’ll only need to run the Python2 installation script file. Please note that this installation script needs to run with sudo privileges, or in a root shell. Without proper system access, M4Baker can’t take advantage of the right directories and binaries on your Linux PC.
To start the compilation process for the M4Baker tool, run the following command in the terminal shell:
python setup.py install --optimize=1
M4Baker’s installation script is relatively quick. When the script finishes, you can instantly start the program with the m4baker command in the terminal window. It also is possible to start up the program by searching your application menu for “M4Baker”.
Preparing your audiobook in M4Baker
The first step to creating a new audiobook in M4Baker is importing the audio files. Add audio files to your new project by clicking the “Edit” menu, then “add Audiobook.”
Press the Ctrl key down on your keyboard and use the mouse to select every audio file you’d like to add. When everything is selected, click the “Open” button to import the tracks to M4Baker.
Note: be sure to keep all audio tracks related to the Audiobook project in the same folder for easy access.
M4Baker sorts audio files in a group, starting with the folder. Double-click on the folder with the mouse and rename it to the of title your new Audiobook. When you’re satisfied with the book’s title, look at the audio files below it in the list. Sort through the list, select each file individually with the mouse, and fill out its information in the info box on the right.
Exporting your audiobook with M4Baker
Your book’s track has the correct information, and everything is ready to go. All that’s left is to export it as an M4Baker audiobook file. To start the export process, click on the book folder and look for the “output” file section.
Click on the icon under “output” file to bring up the file browser. Browse to the directory where you’d like to save the M4Baker audiobook file and click “save.”
Now that the output file is set in the M4Baker app, exporting is ready to begin. Click on the “File” menu and look for the “Process all” button and click on it to start the encoding process.
Let M4Baker encode your new audiobook. When the exporting process is complete, you’ll be able to find it where you saved the output file.