Skip to content

Instantly share code, notes, and snippets.

@dexbarrett
Last active January 13, 2016 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dexbarrett/18be8c26e84682e7f78d to your computer and use it in GitHub Desktop.
Save dexbarrett/18be8c26e84682e7f78d to your computer and use it in GitHub Desktop.

#How to install M4B to MP3 Python Script in Ubuntu 14.04

I was looking for a script/library to convert chapterized M4B audiobooks into separate MP3 files, split by chapter.

There is one, indeed, but the instructions are meant to be used for Ubuntu 10. It is called M4B Converter.


These are the steps I followed to make it work with Ubuntu 14.04

1. Install Python

AFAIK Python 2.7 came already with the distro. But if not, install like so:

sudo apt-get install python2.7

2. Install ffmpeg

This is not available by default on the package repositories. We need to add it from a PPA

sudo apt-add-repository ppa:mc3man/trusty-media

sudo apt-get update

sudo apt-get install ffmpeg gstreamer0.10-ffmpeg

3. Install libav-tools The package used in the original instructions is not available. We have to use a different one.

sudo apt-get install -y libav-tools ubuntu-restricted-extras

sudo apt-get install -y libavcodec-extra-54 libavformat-extra-54

4. Install MP4V2 library

Download the library from here: https://code.google.com/p/mp4v2/downloads/list

I used this particular version: https://mp4v2.googlecode.com/files/mp4v2-2.0.0.tar.bz2


Note: this first step may be optional. I had to do it because otherwise I started getting compilation errors:

apt-get install build-essential


cd into the folder where you downloaded the library, then run these commands to extract and build it:

tar mp4v2-2.0.0.tar.bz2

cd mp4v2-2.0.0/

rm -fr build/

mkdir build/

cd build/

../configure

make

make install

make install-man

5. Download the M4B converter script

Get the repo https://github.com/valekhz/m4b-converter/archive/master.zip

Extract it and cd into the folder


Basic usage of the script

python m4b.py <path_of_m4b_file>

For more information about the usage, go the repo's ReadMe


I haven't used this for a while but I remember that the original code has something that needs to be changed in order to work properly. There is a fix here; it needs to be changed manually since the patch was never added to the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment