I have ripped files from an audio CD I just bought. I ripped using the Music
app on my Macbook Pro, Catalina 10.15.6 - output format was .wav
as there was no option for FLAC
. My plan was to change format using ffmpeg
:
% ffmpeg -v
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
Except for the "album cover artwork" addition, the .wav-to-.flac
conversion implemented in the short bash
script below seems to have worked as expected:
#!/bin/bash
for file in *.wav
do
echo $file
ffmpeg -loglevel quiet -i "$file" -ar 48000 -c:a flac -disposition:v AnotherLand.png -vsync 0 -c:v png "${file/%.wav/.flac}"
done
A script very similar to this one worked some time ago on a series of FLAC-to-FLAC
conversions I had to do to reduce the bit depth. However, in that case, the original FLAC
files already had the artwork embedded. Since this script produced usable audio files, I decided that I would try adding the artwork with a second ffmpeg
command.
I did some research, which informed me that there have been issues with ffmpeg
(1, 2, 3, 4) on adding album artwork to FLAC
files.
I have tried several commands given in the references above, but still have not found a way to add album artwork to my FLAC
files. The following command was a highly upvoted answer, which I felt would work, but didn't:
% ffmpeg -i "01 Grave Walker.flac" -i ./AnotherLand.png -map 0:0 -map 1:0 -codec copy -id3v2_version 3 -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (front)" output.flac
...
Input #0, flac, from '01 Grave Walker.flac':
Metadata:
encoder : Lavf58.76.100
Duration: 00:06:59.93, start: 0.000000, bitrate: 746 kb/s
Stream #0:0: Audio: flac, 48000 Hz, stereo, s16
Input #1, png_pipe, from './AnotherLand.png':
Duration: N/A, bitrate: N/A
Stream #1:0: Video: png, rgba(pc), 522x522, 25 fps, 25 tbr, 25 tbn, 25 tbc
File 'output.flac' already exists. Overwrite? [y/N] y
[flac @ 0x7fb4d701e800] Video stream #1 is not an attached picture. Ignoring
Output #0, flac, to 'output.flac':
Metadata:
encoder : Lavf58.76.100
Stream #0:0: Audio: flac, 48000 Hz, stereo, s16
Stream #0:1: Video: png, rgba(pc), 522x522, q=2-31, 25 fps, 25 tbr, 25 tbn, 25 tbc
Metadata:
title : Album cover
comment : Cover (front)
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #1:0 -> #0:1 (copy)
...
I don't understand the error message: Video stream #1 is not an attached picture.
It seems to imply that that the artwork is "attached" (embedded ???) in the input file, but as I've specified the artwork is a separate file, this makes no sense to me.
Add -disposition:v attached_pic
:
ffmpeg -i audio.flac -i image.png -map 0:a -map 1 -codec copy -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (front)" -disposition:v attached_pic output.flac