Fixed a regression. m4a and m4b now have coverart.

This commit is contained in:
upuv 2018-05-24 15:36:05 +10:00
parent 11292dc4c4
commit eaf75eb2e2
2 changed files with 30 additions and 1 deletions

View File

@ -72,6 +72,18 @@ if ! [[ $(type -P "$GREP") ]]; then
exit 1 exit 1
fi 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. # 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 # 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}." log "Done creating chapters. Chaptered files contained in ${output_directory}."
fi 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 if [[ ${extension} == "m4a" && ${container}="m4b" ]]; then
mv "${full_file_path}" "${full_file_path/.m4a/.m4b}" mv "${full_file_path}" "${full_file_path/.m4a/.m4b}"
fi fi

View File

@ -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 * bash 4.3.42 or later tested
* ffmpeg version 2.8.3 or later * ffmpeg version 2.8.3 or later
* libmp3lame (came from lame package on Arch, not sure where else this is stored) * 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 ## OSX
Thanks to thibaudcolas, this script has been tested on OSX 10.11.6 El Capitan. YMMV, but it should work for 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 * Can be done by using the **-f** or **--flac** command line switches
* FLAC is an open format with royalty-free licensing * 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 ### Defaults
* Specifying the AUTHCODE. * Specifying the AUTHCODE.
In order of __precidence__. In order of __precidence__.