55

I have a bunch of MP3 files that have their album art included within the file itself. I am now looking for a way to extract them to store them separably, at best from command line.

Is there a way to achieve this?

k0pernikus
  • 14,853
  • 21
  • 58
  • 79

6 Answers6

72

I just found out that ffmpeg will do the trick!

ffmpeg -i file.mp3 -an -c:v copy file.jpg
Cri
  • 721
  • 1
  • 5
  • 3
  • 1
    This failed using `ffmpeg` 2.0.2 on my Synology NAS (`file.jpg: Invalid argument`), but works using 2.3 on OS X Mavericks. Thanks! – Richard Barnett Feb 15 '15 at 07:48
  • It worked on Windows too. Using http://stackoverflow.com/questions/8397674/windows-batch-file-looping-through-directories-to-process-files you can process files batch style. – Gruber Sep 09 '16 at 18:00
  • This method is great because ffmpeg works on basically any music file you throw at it. However, it seems quite slow, even on a new machine with a i7 processor. Any way to speed extraction up? – rien333 Sep 29 '18 at 15:21
  • 2
    What if it's a PNG image? Do I have to know image format beforehand? – Aleksandr Kravets May 09 '20 at 19:15
  • On a Mac (Mojave), using 'ffmpeg version 4.2.3', it failed with "Invalid PNG signature 0xFFD8FFE000104A46." – LOlliffe Jun 26 '20 at 03:59
  • @AleksandrKravets from what I understand (tried it with some images) it simply converts the album image to the respective filetype. In my case the png seemed to retain less functional data opposed to the jpeg. (To clarify the data used: I'm doing the "please don't open me in a browser"-puzzle, link to someone who solves it on yt (with source file in the description): https://youtu.be/mxrmrJXLN8M ) – user12042 Aug 07 '20 at 12:25
  • Is there some way to do a "dry run" of this to merely find out whether the audio file contains an image without extracting it? – xeruf Jul 27 '21 at 21:58
31

You can use eyed3 which is a great utility for handling id3 tags. To extract all images from an mp3 file you can use:

eyeD3 --write-images=DIR mp3_file

This will write all embedded images from the mp3 file to the specified directory.

Ulrich Dangel
  • 25,079
  • 3
  • 80
  • 80
  • On Ubuntu, the version currently provided (0.6.18) makes corrupt image files. – scruss Jun 02 '15 at 10:42
  • you can also use it for adding album art to mp3 files (and all sorts of other manipulations). A very useful tool (used in ubuntu 18.04). – BISI Aug 15 '20 at 17:12
6

If you use the Windows version of VLC media player, you can find the album art for all files you played in

 %appdata%\VLC\art\artistalbum

by default. One folder per artist, one subfolder for each album.

Evhz
  • 137
  • 8
Wolfram Schmied
  • 161
  • 1
  • 1
3

If you use Linux version of VLC media player, by default you can find the album art for all files you played in a directory similar to this one:

$HOME/.cache/vlc/art/artistalbum/Sergei Rachmaninoff/Paganini Rhapsody _ Piano Concerto no. 2

(one folder per artist, one subfolder for each album)

Pawel Debski
  • 393
  • 2
  • 16
0

If you use Mac, it is in:

~/Library/Caches/org.videolan.vlc/art

-1

With mp3tag you can do it perfectly. Extract the cover image from one mp3 and put it into another, so it will belong to the same album and that will reflect when you upload them go Google Music for example.

PersianGulf
  • 10,728
  • 8
  • 51
  • 78
Smeterlink
  • 195
  • 1
  • 9
  • 3
    It might be helpful to point out a simple example of how one might go about completing the task. E.g., include a few sample commands or choice quotes from the man page to point the OP (and other readers) in the right direction. – HalosGhost Aug 05 '16 at 18:49
  • NOT. wanted to post the manpage from mp3tag in unbuntu 18.04, but this is not the place. So here's the SYNOPSIS from the manpage "mp3tag [ -s song ] [ -a artist ] [ -l album ] [ -y year ] [-e comment ] [ -k track ] [ -g genre ] [ -r ] file [ file ... ]" as you can see, no facility for dealing with album art, other than -r, which will "Merge new tag with any preexisting tag in the file" – BISI Aug 05 '20 at 03:53