问题
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.
回答1:
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 -metadata
option will be well interpreted
Note: the metadata comment is case-sensitive.
回答2:
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
.
回答3:
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
来源:https://stackoverflow.com/questions/18710992/how-to-add-album-art-with-ffmpeg