Merge pull request #205 from nysasounds/cover-art

Cover art
This commit is contained in:
Krumpet Pirate 2022-02-09 17:49:20 -05:00 committed by GitHub
commit 3e42539812
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 17 deletions

View File

@ -968,23 +968,29 @@ do
if [ -f "${cover_file}" ]; then if [ -f "${cover_file}" ]; then
log "Adding cover art" log "Adding cover art"
# Create temporary output file name - ensure extention matches previous appropriate output file to keep ffmpeg happy # FFMGEP does not support MPEG-4 containers fully #
cover_output_file="${output_file%.*}.cover.${output_file##*.}" if [ "${container}" == "mp4" ] ; then
# Copy audio stream from current output, and video stream from cover file, setting appropriate metadata mp4art --add "${cover_file}" "${output_file}"
</dev/null "$FFMPEG" -loglevel quiet \ # FFMPEG for everything else #
-nostats \ else
-i "${output_file}" \ # Create temporary output file name - ensure extention matches previous appropriate output file to keep ffmpeg happy
-i "${cover_file}" \ cover_output_file="${output_file%.*}.cover.${output_file##*.}"
-map 0:a:0 \ # Copy audio stream from current output, and video stream from cover file, setting appropriate metadata
-map 1:v:0 \ </dev/null "$FFMPEG" -loglevel quiet \
-acodec copy \ -nostats \
-vcodec copy \ -i "${output_file}" \
-id3v2_version 3 \ -i "${cover_file}" \
-metadata:s:v title="Album cover" \ -map 0:a:0 \
-metadata:s:v comment="Cover (front)" \ -map 1:v:0 \
"${cover_output_file}" -acodec copy \
# Replace original output file with version including cover -vcodec copy \
mv "${cover_output_file}" "${output_file}" -id3v2_version 3 \
-metadata:s:v title="Album cover" \
-metadata:s:v comment="Cover (front)" \
"${cover_output_file}"
# Replace original output file with version including cover
mv "${cover_output_file}" "${output_file}"
fi
fi fi
# ----- # -----

View File

@ -20,6 +20,7 @@ Audible fails for some reason.
* GNU sed - see above * GNU sed - see above
* GNU find - see above * GNU find - see above
* jq - only if `--use-audible-cli-data` is set or if converting an .aaxc file * jq - only if `--use-audible-cli-data` is set or if converting an .aaxc file
* mp4art used to add cover art to m4a and m4b files. Optional
* mediainfo used to add additional media tags like narrator. Optional * mediainfo used to add additional media tags like narrator. Optional
## Usage(s) ## Usage(s)
@ -218,6 +219,28 @@ brew install grep
brew install findutils brew install findutils
``` ```
#### mp4art/mp4chaps
_Note: This is an optional dependency, required for adding cover art to m4a and b4b files only._
__Ubuntu, Linux Mint, Debian__
```
sudo apt-get update
sudo apt-get install mp4v2-utils
```
On Debian and Ubuntu the mp4v2-utils package has been deprecated and removed, as the upsteam project is no longer maintained.
The package was removed in Debian Buster, and Ubuntu Focal [ 20.04 ].
__CentOS, RHEL & Fedora__
```
# CentOS/RHEL and Fedora users make sure that you have enabled atrpms repository in system. Lets begin installing FFmpeg as per your operating system.
yum install mp4v2-utils
```
__MacOS__
```
brew install mp4v2
```
#### mediainfo #### mediainfo
_Note: This is an optional dependency._ _Note: This is an optional dependency._