如何使用 ffmpeg 添加专辑封面? [英] How to add album art with ffmpeg?
问题描述
我一直在为 mp3 文件添加专辑封面.
I've been stuck to add album art on mp3 files.
我已经研究并搜索了这个问题,但还没有找到解决方案.ffmpeg
文档建议使用此脚本将图像(专辑封面)添加到 mp3 中:
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
来源: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'
我寻找了另一个解决方案并得到了这个:http://trac.ffmpeg.org/ticket/2221:
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
这将返回相同的输出:
Unrecognized option 'c'
Failed to set value 'copy' for option 'c'
有人可以帮我吗?
nb:我使用 ubuntu 12.04 和 ffmpeg 版本 0.8.6-4:0.8.6-0.
nb: I use ubuntu 12.04 and ffmpeg version 0.8.6-4:0.8.6-0.
谢谢.
推荐答案
使用最新版本,
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
使用-map
将输入流与输出相关联
使用 -c copy
直接 demux/remux-id3v2_version 3
是命令行中缺少的内容.请注意,这将编写 IDV2.3,但您可以要求使用 2.4 (-id3v2_version 4
)
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
)
使用 -id3v2_version 3
选项 -metadata
选项将被很好地解释
with the -id3v2_version 3
option the -metadata
option will be well interpreted
注意:元数据注释区分大小写.
Note: the metadata comment is case-sensitive.
这篇关于如何使用 ffmpeg 添加专辑封面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!