This is the fastest way to create an ipod-playable m4b file. The “drawback” is that the codec is proprietary but this is how you’d put it, it is free and the most efficient in quality and encoding.
Download the latest Nero Aac MPEG4 Encoder/Decoder binary from here. Unpack, copy neroAacDec, neroAacEnc and neroAacTag to ~/bin.
mkdir -p ~/bin mkdir neroaac mv NeroDigitalAudio.zip neroaac/ unzip neroaac/NeroDigitalAudio.zip mv neroaac/linux/* ~/bin/ rm -rf neroaac
Make sure ffmpeg is available:
sudo yum -y install ffmpeg
Now create the script you will use in your directory with mp3 files:
leafpad ~/bin/make_ipod_audiobook
The steps are explained below.
Create some useful variables and directories. This will contain temporary files:
SESS_DIR=/tmp/session_DIR_$$ mkdir -p "$SESS_DIR"
Output directory and file:
OUTDIR=pwd
OUTFILE="$OUTDIR"/"$3".m4b
ffmpeg recode to wav and simultaneously create command for neroAacEnc:
COMMAND="" for F in *.[Mm][Pp]3 do ffmpeg -i "$F" "$SESS_DIR/${F%.*}".wav COMMAND="$COMMAND-if ${F%.*}.wav " done
Run neroAacEnc with all prepared parameters:
cd "$SESS_DIR"
neroAacEnc $COMMAND-of tmp.m4a
Set tags:
mv tmp.m4a tmp.mp4 neroAacTag tmp.mp4 -meta:genre="Audiobook" -meta:artist="$1" -meta:album="$2" -meta:title="$3"
Finally, everything within a ready-made script:
#!/bin/bash [ "$#" -lt 1 ] && exec echo -e "usage: $0 [author] [series] [book name]" SESS_DIR=/tmp/session_DIR_$$ mkdir -p "$SESS_DIR" OUTDIR=pwd
OUTFILE="$OUTDIR"/"$3".m4b COMMAND="" for F in *.[Mm][Pp]3 do ffmpeg -i "$F" "$SESS_DIR/${F%.*}".wav COMMAND="$COMMAND-if ${F%.*}.wav " done cd "$SESS_DIR"neroAacEnc $COMMAND-of tmp.m4a
neroAacTag tmp.m4a -meta:genre="Audiobook" -meta:artist="$1" -meta:album="$2" -meta:title="$3" mv tmp.m4a "$OUTFILE" cd "$OUTDIR" rm -rf "$SESS_DIR"
After you save the script and make it executable, you can run:
cd DIR_WITH_LOTS_OF_MP3_FILES make_ipod_audiobook "Author" "Series" "Title"
The output file, $OUTFILE, will also have chapters set up automatically be the encoder. The quality is better than for those made with faac, and file size is normally 1/4 less too.
Enjoy!
Time for bash bashing 😉
Don’t create temp dirs like that – use mktemp for that, it’s part of the coreutils package.
I can’t see any way that this would create chapters.
If I remember correctly, the chapters like these are not supported on Ipod or Android players.