Extract Cover Art from Audio Using FFmpeg

This article provides a quick, step-by-step guide on how to extract embedded cover art or album artwork from audio files using the command-line tool FFmpeg. You will learn the exact commands needed to save the hidden image as a standalone JPEG or PNG file, understand how the command arguments work, and see examples for popular formats like MP3 and FLAC.

The Basic Extraction Command

To extract the embedded cover art from an audio file without re-encoding the image, use the following command structure:

ffmpeg -i input.mp3 -an -vcodec copy cover.jpg

How the Command Works

  • -i input.mp3: Specifies the input audio file containing the embedded artwork.
  • -an: Disables the audio stream. This tells FFmpeg to ignore the actual music tracks and focus only on the video/image stream.
  • -vcodec copy (or -c:v copy): Directs FFmpeg to copy the video stream (the embedded image) directly without re-encoding it. This ensures the extracted image retains its original quality and the process completes instantly.
  • cover.jpg: The name and format of the output image file.

Handling Different Audio Formats

The extraction process works identically for other major audio formats that support embedded metadata, such as FLAC, M4A, or OGG.

For a FLAC file, simply change the input file name:

ffmpeg -i input.flac -an -vcodec copy cover.jpg

Determining the Correct Image Extension

Embedded artwork is typically stored as either a JPEG or a PNG. While FFmpeg will usually extract the image regardless of the output extension you specify, matching the output extension to the container's native format prevents file header mismatches.

You can identify the original image format before extracting by running ffprobe:

ffprobe input.mp3

Look at the stream information in the output. It will display the image format (e.g., Stream #0:1: Video: mjpeg or png). If it is mjpeg, use .jpg as your output extension; if it is png, use .png.