How to Add Album Cover to FLAC Using FFmpeg
Adding cover art to your music files makes your digital library visually appealing and ensures that media players display the correct artwork during playback. This guide provides a straightforward, step-by-step tutorial on how to use the powerful command-line tool FFmpeg to embed an album cover image (such as a JPEG or PNG) directly into a FLAC audio file without re-encoding the audio.
The Basic Command
To attach an image to a FLAC file, you need your original audio file
(e.g., input.flac) and the image file (e.g.,
cover.jpg). Run the following command in your terminal or
command prompt:
ffmpeg -i input.flac -i cover.jpg -map 0:a -map 1:v -c copy -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (front)" output.flacHow the Command Works
-i input.flac: Specifies the input audio file as the first input (index 0).-i cover.jpg: Specifies the input image file as the second input (index 1).-map 0:a: Selects the audio stream from the first input file.-map 1:v: Selects the video (image) stream from the second input file to be used as the attachment.-c copy: Copies both the audio and image streams directly without re-encoding them. This process is instant and preserves the original quality of both files.-metadata:s:v title="Album cover": Sets the metadata title of the video stream to “Album cover”.-metadata:s:v comment="Cover (front)": Flags the image specifically as the front cover, which helps media players identify and display it correctly.output.flac: The name of the newly generated FLAC file containing the embedded album art.
Verifying the Output
Once the process is complete, you can verify that the image was
successfully embedded by playing the output.flac file in a
media player like VLC, Foobar2000, or MusicBee. Alternatively, you can
use FFmpeg to inspect the metadata of the new file by running:
ffprobe output.flacThis command will list the streams inside the file, showing both the
flac audio stream and a mjpeg or
png video stream representing the attached cover art.