Adding album art to ogg files from the command line
I’ve recently been trying to script the process of transcoding some flac files to ogg. This is mostly a pretty smooth process, except for one hiccup: it seems that the command-line tools used to transcode music files don’t handle cover art for ogg files. All the other tags seem to be preserved, but not album art.
All the command-line tools used to edit ogg tags also don’t seem to handle album art. Some GUI tools, like MP3Tag, do handle cover art, but don’t have a command-line interface.
If you Google a solution to this you’ll get a wide variety of answers ranging from “base64 encode a jpg and insert it as a tag” to “ogg doesn’t support album art, sorry”. These are all wrong answers. In fact ogg does support album art, but base64 encoding isn’t enough. You have to use a certain tag and wrap the base64-encoded jpg in a special “frame”.
This isn’t something easily done by hand, but after spending a lot of time trawling for an easier solution, I came across a Stack Exchange post from user Biapy. They present part of a script from a larger toolset that adds cover art to ogg files.
I cleaned up and wrapped that script into an easy-to-use Bash script. You can download it here.
To use this script to add a cover image to an ogg file:
ogg-cover-art cover.jpg track.ogg