Embed Cover Art in Ogg Vorbis Using FFmpeg
Embedding album artwork into Ogg Vorbis audio files is a great way to
ensure your music library displays correctly across various media
players. Unlike MP3 files that use ID3 tags, Ogg Vorbis stores cover art
inside a metadata block called METADATA_BLOCK_PICTURE. This
guide provides the exact, straight-to-the-point FFmpeg commands needed
to embed cover art into your Ogg files, whether you are copying the
audio stream or encoding a new file from scratch.
The Basic Command (No Re-encoding)
If you already have an Ogg Vorbis file and simply want to add a JPEG or PNG cover image without losing any audio quality, use the following command. This method copies the audio stream directly:
ffmpeg -i input.ogg -i cover.jpg -map 0:0 -map 1:0 -c copy -disposition:v attached_pic output.oggCommand Breakdown
-i input.ogg: Specifies the input audio file.-i cover.jpg: Specifies the image file you want to use as cover art (PNG files also work).-map 0:0: Maps the first stream (audio) from the first input file.-map 1:0: Maps the first stream (image) from the second input file.-c copy: Instructs FFmpeg to copy both the audio and image streams without re-encoding them, preserving original quality and saving time.-disposition:v attached_pic: Tells FFmpeg to write the image stream to the output file’s metadata as an attached picture (album cover).
Embedding Cover Art While Encoding
If you are converting a lossless file (like WAV or FLAC) to Ogg Vorbis and want to embed the cover art during the encoding process, use this command:
ffmpeg -i input.wav -i cover.jpg -map 0:a -map 1:v -c:a libvorbis -q:a 6 -c:v copy -disposition:v attached_pic output.oggIn this variation: * -c:a libvorbis:
Uses the Vorbis encoder to compress the audio. *
-q:a 6: Sets the audio quality level (6 is
a high-quality setting, roughly 192 kbps). *
-c:v copy: Copies the image stream
directly without re-encoding the JPG/PNG.
Verifying the Changes
To verify that the cover art was successfully embedded into your Ogg
file, you can run the ffprobe command:
ffprobe output.oggIn the console output, you should see two streams listed:
Stream #0:0 (the Vorbis audio stream) and
Stream #0:1 (the video/image stream marked as
attached_pic).