32

I've been stuck to add album art on mp3 files.

I've already researched and googled this issue but haven't found a solution yet. The ffmpeg documentation recommends this script to add image (album art) to mp3 :

ffmpeg -i input.mp3 -i cover.png -c copy -map 0 -map 1 -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (Front)" out.mp3

Source from: http://www.ffmpeg.org/ffmpeg-all.html#mp3

But it doesn't work. My console output is:

Unrecognized option 'c'
Failed to set value 'copy' for option 'c'

I looked for another solution and got this: http://trac.ffmpeg.org/ticket/2221:

ffmpeg -i input.mp3 -i cover.png -map 0:0 -map 1:0 -c copy -id3v2_version 3 -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (Front)" out.mp3

This returns the same output:

Unrecognized option 'c'
Failed to set value 'copy' for option 'c'

Anybody can help me, please?

nb: I use ubuntu 12.04 and ffmpeg version 0.8.6-4:0.8.6-0.

Thanks.

petezurich
  • 6,779
  • 8
  • 29
  • 46
Adi Ricky k
  • 321
  • 1
  • 3
  • 3
  • just about the -c ? have you try '-acodec copy' as you use an old version... and try to update ! – alexbuisson Sep 10 '13 at 05:11
  • I already tried to replace -c with -codec but return of output is same : Unrecognized option 'codec' Failed to set value 'copy' for option 'codec' – Adi Ricky k Sep 10 '13 at 05:45
  • 2
    You're using an old, fake version of ffmpeg that is not supported by the online documentation. See [Who can tell me the difference and relation between ffmpeg, libav, and avconv?](http://stackoverflow.com/a/9477756/1109017). You can get recent, real ffmpeg by following a [step-by-step guide to compile ffmpeg](http://trac.ffmpeg.org/wiki/UbuntuCompilationGuide), or by simply using a [Linux build of ffmpeg](https://ffmpeg.org/download.html#LinuxBuilds). – llogan Sep 10 '13 at 16:26

3 Answers3

43

With Recent version,

ffmpeg -i in.mp3 -i test.png -map 0:0 -map 1:0 -c copy -id3v2_version 3 -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (front)" out.mp3

Use -map to associate input stream to the output
Use -c copy to directly demux/remux
The -id3v2_version 3 is what is missing in your command line. Note that that wil write an IDV2.3 but you can ask for a 2.4 (-id3v2_version 4)

with the -id3v2_version 3 option the -metadataoption will be well interpreted

Note: the metadata comment is case-sensitive.

dantheman2865
  • 313
  • 1
  • 11
alexbuisson
  • 6,404
  • 2
  • 25
  • 40
  • 1
    One '-metadata:s:v' option above was lacking the '-'. This gave me an error "[NULL @ 0x7ffd7400fa00] Unable to find a suitable output format for 'metadata:s:v' || metadata:s:v: Invalid argument". I corrected it in the answer. – Jim DeLaHunt Jul 17 '16 at 03:44
  • 1
    _comment="Cover (front)"_ - not _comment="Cover (Front)"_ – IvanM Mar 28 '18 at 07:33
  • I have to say that should not skip the "-id3v2_version 3" parameter. Without it the cover will be visible on Mac, but not on Windows. – Andres Aug 01 '18 at 18:53
  • Using this method album art shows in some programs (vlc and totem) but not in others (rhythmbox and nautilus) which normally show album art for mp3 files. – SuprMan Oct 22 '20 at 23:24
16

There is an important thing to notice here, that made me loose an hour of work:

ffmpeg -i in.mp3 -i test.jpeg -map 0:0 -map 1:0 -codec copy -id3v2_version 3 \ 
-metadata:s:v title="Album cover" -metadata:s:v comment="Cover (front)" out.mp3

The f in comment="Cover (front)" must be lowercase. If not, the picture type in the ID3 header will not be set !

Another hint that might help somebody: To avoid that a JPEG cover image is converted to png, you have to set -codec copy.

Lorenz Meyer
  • 17,418
  • 21
  • 68
  • 109
1

the problem is that you are not defining what codec you want to copy. In case of the audio should be -c:a copy the cover is recognized as video (go figure!!), so -c:v copy

ffmpeg -i audio-in.mp3 -i picture.png -c:a copy -c:v copy -map 0:0 -map 1:0 -id3v2_version 3 -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (front)" audio-out.mp3
Yuri Tkachenko
  • 2,444
  • 24
  • 30
Mauricio
  • 11
  • 2