Thursday, 5 May 2011

Converting MP3 to M4B audio books for an ipod in linux

I recently bought an ipod for listening to audiobooks. The reason for the ipod is that it has an audiobook feature. The ipod has a special file format for audio books called m4b If the audio book is in a m4b format the ipod will track where in the audio book you press paused. Then you can play other music. When you come back to play the audio book it will remember your remember playback position. Mp3 does not have this feature. If the audio book is in the file format mp3 then you will have to remember where you stopped listening before you can play other music. Then when you play the mp3 audio book again you have to forward to that time where you left it last. Also if the file is in m4b it will show up in the ipod audiobook section. Converting 1 file This will turn one MP3 in ipod M4B. This will default to converting the mp3 to a M4B file at a sample rate of 44000Hz. -b 80 below is the bit rate you want the m4b file to be.

mpg123 -s "Memory techniques.mp3" | faac -b 80 -P -X -w -o "Memory techniques.m4b" -


Changing the sample rate of the file
If the audio book out put is slow compared to the mp3 when you hear the m4b file. For instance the person reading the audio book is talking slow. The problem is you are converting a mp3 that does not have a sample rate of 44000Hz to a m4b file with a sample rate of 44000hz. Find the sample rate of the mp3 file and add it as a input in the command. For instance the mp3 below has a sample rate of 24000Hz. Now the M4B file will have a sample rate of 24000Hz. The audio output of the M4B file will be the same as the mp3.

mpg123 -s "Even Better Memory techniques.mp3" | faac -b 80 -R 24000 -X -w -o "Even Better Memory techniques.m4b" -
Â
Also if the file playback is talking too fast then you need to decrease the sample rate. You could of made the file with a sample rate of 44KHz and person is talking fast. Decrease to 24Khz and see if the person speach has slowed down to a normal level.
 
Converting multiple mp3s to one m4b file
Alot of the time an audio book is broken into multiple mp3 files. Instead of having multiple m4b files you can convert all the mp3 files in one m4b file. This command will get all the mp3 files in a directory and add them all into one m4b file.
First get all the mp3 names in to one file
ls *.mp3 > inputfile
Then start this command to have all the mp3 in one m4b file to listen to on your ipod and have the bookmark feature.
mpg123 -@ inputfile -q -w - | faac -w  --track "1/1"  --artist "<AUTHOR>" --title "<TITLE>" --album "<TITLE>" --writer "<AUTHOR>"  --genre "Audiobook" -o "DISC1.m4b" -

No comments:

Post a Comment