ffmpeg : convert FLAC to mp3 and add album art in one step

这一生的挚爱 提交于 2019-12-08 13:02:07

问题


I convert FLAC to MP3 using

ffmpeg -i x.flac -f mp3 -vn -b:a 64K x.mp3

and I add album art using

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

Is it possible to do it in one step? Because I want to do it during "live" transcoding.


回答1:


You can use a pipe instead of using a temporary file. You just have to explicitly specify the format of input/output. Example:

ffmpeg -i input.mp3 -f mp3 - | ffmpeg -f mp3 -i - -y output.mp3

Probably your version would be:

ffmpeg -i x.flac -f mp3 -vn -b:a 64K x.mp3 - | ffmpeg -f mp3 -i - -i x.jpg -map 0:0 -map 1:0 -c copy -id3v2_version 3 -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (Front)" xx.mp3

That is if you really can't do

ffmpeg -i x.flac -i x.jpg -map 0:0 -map 1:0 -c copy -id3v2_version 3 -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (Front)" -f mp3 -vn -b:a 64K xx.mp3
  • -y makes ffmpeg overwrite output file by default.


来源:https://stackoverflow.com/questions/24840708/ffmpeg-convert-flac-to-mp3-and-add-album-art-in-one-step

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!