5

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
1
  • 3
    Seems more like a tag editing program might be better than ffmpeg
    – Xen2050
    Commented Dec 28, 2017 at 22:32

2 Answers 2

9

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

2
  • 1
    Thanks. This is at the moment the closest answer. However I'm now experiencing a problem if I want to do the copy operation without generating a new file. I have updated my original post. Do you know why?
    – fbid
    Commented Dec 31, 2017 at 20:03
  • 1
    You are overwriting the the input file with the output during the operation. You need to use a different output file. I do not think ffmpeg uses a buffer or create a temporary output that it then renames.. When I do batch operations like this, I would then move the input file to a sub folder or temporary area, and then confirm that the output files are good, and then remove the originals.
    – Yorik
    Commented Jan 2, 2018 at 15:11
2

While you don’t specify your OS, I recommend using Mp3Tag, which is a freeware Windows program that only modifies metadata and tags.

None of the original encoding or quality of audio files will be altered regardless of what you change. You can customize the column options to display things like codec, bitrate, frequency, and VBR. What's more is that you can batch-edit audio files. Here is a list of all currently supported audio formats:

  • Advanced Audio Coding (aac)
  • Apple Lossless Audio Codec (alac)
  • Audio Interchange File Format (aif, aifc, aiff)
  • Direct Stream Digital Audio (dsf)
  • Free Lossless Audio Codec (flac)
  • Matroska (mka, mkv)
  • Monkey's Audio (ape)
  • Mpeg Layer 3 (mp3)
  • MPEG-4 (mp4, m4a, m4b, m4v, iTunes)
  • Musepack (mpc)
  • Ogg Vorbis (ogg)
  • IETF Opus (opus)
  • OptimFROG (ofr, ofs)
  • Speex (spx)
  • Tom's Audio Kompressor (tak)
  • True Audio (tta)
  • Windows Media Audio (wma)
  • WavPack (wv)
  • WAV (wav)

If you want to change the album artwork, drag your audio file(s) into the main window. To change the artwork you must select the audio files in the main window by hilighting them. If there isn't any artwork already present, drag-and-drop your artwork image into the artwork box.

If there is artwork already present, you must first delete it in order to replace it, simply placing the new image in the box will at first appear to overwrite the old, but will not stay after saving. Select the files with existing artwork then right-click the artwork window and select "Remove cover".

You can add up to two covers (a front and a back), personally I add two fronts as some playback software glitches out and doesn't display the artwork unless both covers are set.

2
  • Specific instructions for using this app to change the album artwork would make this a perfect answer. Commented Dec 30, 2017 at 4:54
  • Thanks for the advise, I have updated my answer. Commented Dec 30, 2017 at 5:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .