Changes between Version 4 and Version 5 of Howto/CreateM4bAudioBooks


Ignore:
Timestamp:
26/01/09 21:36:11 (9 years ago)
Author:
tj
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Howto/CreateM4bAudioBooks

    v4 v5  
    11= Create M4B Audio Book for Apple iPod, or convert M4B to MP3 = 
    2  
    32Here’s how to convert M4B audiobooks (used by Apple iPod) to MP3, and how to create an M4B from one or more MP3s. M4B is an M4A file with ''bookmarks'' so the player can remember where you left off listening and resume from that point later. 
    43 
    54== M4B to MP3 == 
     5For a single file: 
    66 
    7 For a single file: 
    87{{{ 
    98ffmpeg -i <infile.m4b> -acodec libmp3lame -ar 22050 <outfile.mp3> 
    109}}} 
    1110For a bunch of M4B files: 
     11 
    1212{{{ 
    1313for m4b in $(ls -1 *.m4b); do ffmpeg -i $m4b -acodec libmp3lame -ar 22050 ${m4b}.mp3; done 
    1414}}} 
    15  
    1615== Single MP3 to M4B == 
    1716A standard Ubuntu installation of `ffmpeg` doesn't use the `libfaac` library because of legal restrictions in some jurisdictions, so faac needs to be installed from the '''Universe''' repository: 
     17 
    1818{{{ 
    1919sudo apt-get install faac 
     
    2323Here's an example. I have in the Media directory the file "Barack Obama - The Audacity of Hope.mp3" (6 hours 10 minutes) 
    2424 
    25  Note: The book was bought from Audible and played using '''`wine`''' + iTunes because of the Digital ''Restrictions'' Management and captured from the audio card PCM loop-back input using Audacity (16000Hz, 16-bit, stereo) and saved to a 128k, 16000Hz joint-stereo MP3. I want to be able to listen to the file from the iPod nano but wine + iTunes can't (as yet) successfully access the iPod. iTunes can however authorise the PC for DRM playback and play the file (The Audible player won't successfully authorise). 
     25Notes:  [[BR]] 
     26 1. The book was bought from Audible and played using '''`wine`''' + iTunes because of the Digital ''Restrictions'' Management and captured from the audio card PCM loop-back input using Audacity (16000Hz, 16-bit, stereo) and saved to a 128k, 16000Hz joint-stereo MP3. I want to be able to listen to the file from the iPod nano but wine + iTunes can't (as yet) successfully access the iPod. iTunes can however authorise the PC for DRM playback and play the file (The Audible player won't successfully authorise). 
     27 1.  With my [wiki:Linux/Wine/Bug16831 patch for wine] Audible player can now authorise tracks successfully. 
     28 
    2629{{{ 
    2730#!/bin/bash 
     
    4144rm $PIPE 
    4245}}} 
     46 
    4347I edit and save the script mp3tom4b and make it executable: 
     48 
    4449{{{ 
    4550chmod a+x mp3tom4b 
    4651}}} 
    4752Then, in the same directory as the input file, I call the script. Here's a capture from the terminal whilst it is encoding: 
     53 
    4854{{{ 
    4955mp3tom4b 
     
    7884}}} 
    7985ffmpeg runs in the background and starts when faac connects to the pipe. faac reports its progress as it encodes. The final results: 
     86 
    8087{{{ 
    8188ls -lh 
     
    8794 
    8895First thing is to ensure all the MP3 files you want to include in ONE M4B have sequentially numbered names: 
     96 
    8997{{{ 
    9098filename-01.mp3 
     
    92100}}} 
    93101or, if you want to create the M4B from more than 100 M4B files: 
     102 
    94103{{{ 
    95104filename-001.mp3 
     
    99108 
    100109Copy and save the script below to the file create_audiobook and make it executable: 
     110 
    101111{{{ 
    102112chmod 755 create_audiobook 
    103113}}} 
    104114For each M4B audiobook optionally set the tags using environmental variables: 
     115 
    105116{{{ 
    106117export AUTHOR="The Author" 
     
    109120}}} 
    110121Make sure you’ve got plenty of free space on the mount point the source files are on. If you need to have the HUGE temporary files put on another mount point with plenty of space (Allow for more than 3GB of free space) then set the TMP environmental variable to point to a location that has plenty of space and allows users to create/delete files: 
     122 
    111123{{{ 
    112124export TMP=/tmp 
     
    115127 
    116128Now run the script, passing the output filename and the input file mask. Here’s two possible usages: 
     129 
    117130{{{ 
    118131create_audiobook "Terry Pratchett - Colour of Magic" "Terry Pratchett - Colour of Magic - *.mp3" 
     
    120133}}} 
    121134Note the quotes around the two parameters that allows spaces in filenames. 
     135 
    122136{{{ 
    123137#!/bin/bash