Lennart's weblog

Open source, computers, Africa and other more (or less) interesting stuff.

Embedding album art in FLAC files

I recently wanted to add cover art to my collection of FLAC-encoded audio files. I wrote the following simple script to help me automate the process. Running this script in a given directory (I group my music in directories per artist, followed by a subdirectory for each album) with the name of the album art image file name as argument then automatically embeds the image in the FLAC/Vorbis tag.

#!/bin/bash
#
# This script embeds a given image (usually .jpg) as album art in the
# FLAC files in the present directory (and its subdirectories).
#
# Time-stamp: <2011-07-31 20:43:23 (lennart)>
 
coverart=$1
 
find . -name "*.flac" -print0 |xargs -0 metaflac --import-picture-from="$coverart"

4 Comments

  1. Knap hoor!

  2. so what would an example syntax be if I named the file “add-album-art.sh”

    • LCK

      23 April 2014 at 15:00

      That would be: ./add-album-art.sh cover.jpg, which will tag all flac files in the current directory with the cover.jpg image (assuming the cover image is also stored in the current directory).

  3. How about just using metaflac directly? There is no need for find:
    metaflac --import-picture-from=cover.jpg *.flac

Leave a Reply

Your email address will not be published.

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2019 Lennart's weblog

Theme by Anders NorenUp ↑