I’d like to add a picture as album artwork to an MP3 file without losing audio quality. I’m using FFmpeg on Debian, with the command below:
ffmpeg -i input.mp3 -i cover.jpg -c copy -c:a libmp3lame -map 0 -map 1 out.mp3
I don’t know if it’s libmp3lame1
’s fault, but the output file doesn’t have the same bitrate as the original one. It can be easily noticed by looking at the difference in file size between the input and output files since the output file is a few MB less than the input one.
As suggested in the answer by @Yorik I removed the libmp3lame
encoding parameter. This however have lead to another problem. If the input and output file are the same (i.e. I want to add the cover artowork jpg to the same file, without generating a new one), it seems that only the first frame is processed, and the result is a very small file (i.e. 176kB) without any audio.
This is the FFmpeg command I’m using now:
ffmpeg -i test.mp3 -i cover.jpg -c copy -c:a libmp3lame -map 0 -map 1 test.mp3
Best Answer
You want to use
copy
for all (both) streams. By specifying a codec for all audio, you are re-encoding, which is why the bitrate changes. A copy operation ought to be faster as well.Slightly off topic: I have never used ffmpeg (directly) for metadata, but you may be missing some syntax. See for example: https://stackoverflow.com/questions/18710992/how-to-add-album-art-with-ffmpeg