Skip to content
This repository has been archived by the owner on Apr 23, 2023. It is now read-only.

Commit

Permalink
Merge pull request #205 from nysasounds/cover-art
Browse files Browse the repository at this point in the history
Cover art
  • Loading branch information
KrumpetPirate authored Feb 9, 2022
2 parents 6d659ad + c103d48 commit 3e42539
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 17 deletions.
40 changes: 23 additions & 17 deletions AAXtoMP3
Original file line number Diff line number Diff line change
Expand Up @@ -968,23 +968,29 @@ do

if [ -f "${cover_file}" ]; then
log "Adding cover art"
# Create temporary output file name - ensure extention matches previous appropriate output file to keep ffmpeg happy
cover_output_file="${output_file%.*}.cover.${output_file##*.}"
# Copy audio stream from current output, and video stream from cover file, setting appropriate metadata
</dev/null "$FFMPEG" -loglevel quiet \
-nostats \
-i "${output_file}" \
-i "${cover_file}" \
-map 0:a:0 \
-map 1:v:0 \
-acodec copy \
-vcodec copy \
-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}"
# FFMGEP does not support MPEG-4 containers fully #
if [ "${container}" == "mp4" ] ; then
mp4art --add "${cover_file}" "${output_file}"
# FFMPEG for everything else #
else
# Create temporary output file name - ensure extention matches previous appropriate output file to keep ffmpeg happy
cover_output_file="${output_file%.*}.cover.${output_file##*.}"
# Copy audio stream from current output, and video stream from cover file, setting appropriate metadata
</dev/null "$FFMPEG" -loglevel quiet \
-nostats \
-i "${output_file}" \
-i "${cover_file}" \
-map 0:a:0 \
-map 1:v:0 \
-acodec copy \
-vcodec copy \
-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

# -----
Expand Down
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Audible fails for some reason.
* GNU sed - see above
* GNU find - see above
* 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

## Usage(s)
Expand Down Expand Up @@ -218,6 +219,28 @@ brew install grep
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. Let’s begin installing FFmpeg as per your operating system.
yum install mp4v2-utils
```
__MacOS__
```
brew install mp4v2
```

#### mediainfo
_Note: This is an optional dependency._

Expand Down

0 comments on commit 3e42539

Please sign in to comment.