From eaf75eb2e231ce775ca28161c0b300b8006115f9 Mon Sep 17 00:00:00 2001 From: upuv Date: Thu, 24 May 2018 15:36:05 +1000 Subject: [PATCH] Fixed a regression. m4a and m4b now have coverart. --- AAXtoMP3 | 22 +++++++++++++++++++++- README.md | 9 +++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/AAXtoMP3 b/AAXtoMP3 index 6021cfb..67417ae 100755 --- a/AAXtoMP3 +++ b/AAXtoMP3 @@ -72,6 +72,18 @@ if ! [[ $(type -P "$GREP") ]]; then exit 1 fi +# ----- +# Detect if we need mp4art for cover additions to m4a & m4b files. +if [[ "x${extension}" == "xm4a" && "x$(type -P mp4art)" == "x" ]]; then + echo "WARN mp4art was not found on your env PATH variable" + echo "Without it, this script will not be able to add cover art to" + echo "m4b files. Note if there are no other errors the AAXtoMP3 will" + echo "continue. However no cover art will be added to the output." + echo "INSTALL:" + echo "MacOS: brew install mp4v2" + echo "Ubuntu: sudo apt-get install mp4v2-utils" +fi + # ----- # Obtain the authcode from either the command line, local directory or home directory. # See Readme.md for details on how to aquire your personal authcode for your personal @@ -273,7 +285,15 @@ do log "Done creating chapters. Chaptered files contained in ${output_directory}." fi - # Detect if we are actuall m4b instead of m4a + # ---- + # Add the cover art to m4a and m4b file types. + if [[ ${extension} == "m4a" && $(type -P mp4art) ]]; then + mp4art --add "${cover_path}" "${full_file_path}" + log "Added cover art." + fi + + # ---- + # Detect if we are actuall m4b instead of m4a Then rename the file. if [[ ${extension} == "m4a" && ${container}="m4b" ]]; then mv "${full_file_path}" "${full_file_path/.m4a/.m4b}" fi diff --git a/README.md b/README.md index a27f20e..db91440 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,8 @@ can obtain this string from a tool like [audible-activator](https://github.com/i * bash 4.3.42 or later tested * ffmpeg version 2.8.3 or later * libmp3lame (came from lame package on Arch, not sure where else this is stored) +* grep Some OS distributions do not have it installed. +* mp4art used to add cover art to m4a and m4b files. Optional ## OSX Thanks to thibaudcolas, this script has been tested on OSX 10.11.6 El Capitan. YMMV, but it should work for @@ -68,6 +70,13 @@ bash AAXtoMP3 [-f|--flac] [-o|--opus] [-a|-aac] [-s|--single] [-e:mp3] [-e:m4a] * Can be done by using the **-f** or **--flac** command line switches * FLAC is an open format with royalty-free licensing +### M4A and M4B Containers ### +* These containers were created by Apple Inc. They were meant to be the successor to mp3. +* M4A is a container that is meant to hold music and is typically of a higher bitrate. +* M4B is a container that is meant to hold audiobooks and is typically has bitrates of 64k and 32k. +* Both formats are chaptered +* Both support coverart internall + ### Defaults * Specifying the AUTHCODE. In order of __precidence__.