[FFmpeg-user] ffmpeg ignores MP3 comment tag when transcodiing

Ulf Zibis Ulf.Zibis at CoSoCo.de
Mon Jun 30 02:45:14 EEST 2025


Hi,

when i use the lame encoder directly, the comment tag of a mp3 file is conserved:

$ lame -V1 in.mp3 out.mp3
LAME 3.100 64bits (http://lame.sf.net)
Using polyphase lowpass filter, transition band: 19383 Hz - 19916 Hz
Encoding in.mp3 to out.mp3
Encoding as 44.1 kHz j-stereo MPEG-1 Layer III VBR(q=1)
     Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA
  10104/10104 (100%)|    0:04/    0:04|    0:04/    0:04| 54.411x|    0:00
  32 [   29] *
  40 [    0]
  48 [    0]
  56 [    0]
  64 [    0]
  80 [    0]
  96 [    0]
112 [    2] %
128 [    0]
160 [    0]
192 [ 2473] %%%%%%%%%%%%%%%%%%%%%%%%%%%%*
224 [ 5892] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
256 [ 1506] %%%%%%%%%%%%%%%%%*
320 [  202] %%%
-------------------------------------------------------------------------------
    kbps        LR    MS  %     long switch short %
   222.3       98.3   1.7        95.7   2.3   2.0
Writing LAME Tag...done
ReplayGain: +2.1dB

$ mediainfo out.mp3
General
Complete name                            : out.mp3
Format                                   : MPEG Audio
File size                                : 7.04 MiB
Duration                                 : 4 min 23 s
Overall bit rate mode                    : Variable
Overall bit rate                         : 222 kb/s
Album                                    : A Momentary Lapse Of Reason
Album/Performer                          : Pink Floyd
Track name                               : Signs Of Life
Track name/Position                      : 01
Performer                                : Pink Floyd
Genre                                    : Rock
Recorded date                            : 1987
Writing library                          : LAME3.100
Cover                                    : Yes
Cover type                               : Cover (front)
Cover MIME                               : image/jpeg
Comment                                  : Columbia Records 2005 Remastered Edition.

Audio
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 3
Format settings                          : Joint stereo
Duration                                 : 4 min 23 s
Bit rate mode                            : Variable
Bit rate                                 : 222 kb/s
Minimum bit rate                         : 32.0 kb/s
Channel(s)                               : 2 channels
Sampling rate                            : 44.1 kHz
Frame rate                               : 38.281 FPS (1152 SPF)
Compression mode                         : Lossy
Stream size                              : 6.99 MiB (99%)
Writing library                          : LAME3.100
Encoding settings                        : -m j -V 1 -q 0 -lowpass 19.5 --vbr-new -b 32

Image
Format                                   : JPEG
Width                                    : 500 pixels
Height                                   : 500 pixels
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Compression mode                         : Lossy
Stream size                              : 51.9 KiB (1%)

Using ffmpeg, the comment tag is lost:

$ ffmpeg -i in.mp3 -q 1 -c:v copy out.mp3
ffmpeg version 6.1.1-3ubuntu5 Copyright (c) 2000-2023 the FFmpeg developers
   built with gcc 13 (Ubuntu 13.2.0-23ubuntu3)
   configuration: --prefix=/usr --extra-version=3ubuntu5 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --disable-omx --enable-gnutls --enable-libaom --enable-libass --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-openal --enable-opencl --enable-opengl --disable-sndio --enable-libvpl --disable-libmfx --enable-libdc1394 
--enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-ladspa --enable-libbluray --enable-libjack --enable-libpulse --enable-librabbitmq --enable-librist --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libx264 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-sdl2 --enable-libplacebo --enable-librav1e --enable-pocketsphinx --enable-librsvg --enable-libjxl --enable-shared
   libavutil      58. 29.100 / 58. 29.100
   libavcodec     60. 31.102 / 60. 31.102
   libavformat    60. 16.100 / 60. 16.100
   libavdevice    60.  3.100 / 60.  3.100
   libavfilter     9. 12.100 /  9. 12.100
   libswscale      7.  5.100 /  7.  5.100
   libswresample   4. 12.100 /  4. 12.100
   libpostproc    57.  3.100 / 57.  3.100
Incorrect BOM value
Error reading comment frame, skipped
Incorrect BOM value
Error reading lyrics, skipped
Input #0, mp3, from 'in.mp3':
   Metadata:
     album           : A Momentary Lapse Of Reason
     genre           : Rock
     title           : Signs Of Life
     artist          : Pink Floyd
     track           : 01
     album_artist    : Pink Floyd
     date            : 1987
   Duration: 00:04:23.97, start: 0.025056, bitrate: 321 kb/s
   Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 320 kb/s
     Metadata:
       encoder         : LAME3.97
   Stream #0:1: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 500x500 [SAR 1:1 DAR 1:1], 90k tbr, 90k tbn (attached pic)
     Metadata:
       comment         : Cover (front)
Stream mapping:
   Stream #0:1 -> #0:0 (copy)
   Stream #0:0 -> #0:1 (mp3 (mp3float) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
Output #0, mp3, to 'out.mp3':
   Metadata:
     TALB            : A Momentary Lapse Of Reason
     TCON            : Rock
     TIT2            : Signs Of Life
     TPE1            : Pink Floyd
     TRCK            : 01
     TPE2            : Pink Floyd
     TDRC            : 1987
     TSSE            : Lavf60.16.100
   Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 500x500 [SAR 1:1 DAR 1:1], q=2-31, 90k tbr, 90k tbn (attached pic)
     Metadata:
       comment         : Cover (front)
   Stream #0:1: Audio: mp3, 44100 Hz, stereo, fltp
     Metadata:
       encoder         : Lavc60.31.102 libmp3lame
[out#0/mp3 @ 0x5853cd73b540] video:52kB audio:7174kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.005825%
size=    7226kB time=00:04:23.89 bitrate= 224.3kbits/s speed=53.3x

$ mediainfo out.mp3
General
Complete name                            : out.mp3
Format                                   : MPEG Audio
File size                                : 7.06 MiB
Duration                                 : 4 min 23 s
Overall bit rate mode                    : Variable
Overall bit rate                         : 223 kb/s
Album                                    : A Momentary Lapse Of Reason
Album/Performer                          : Pink Floyd
Track name                               : Signs Of Life
Track name/Position                      : 01
Performer                                : Pink Floyd
Genre                                    : Rock
Recorded date                            : 1987
Writing library                          : LAME3.100
Cover                                    : Yes
Cover type                               : Cover (front)
Cover MIME                               : image/jpeg

Audio
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 3
Format settings                          : Joint stereo
Duration                                 : 4 min 23 s
Bit rate mode                            : Variable
Bit rate                                 : 224 kb/s
Channel(s)                               : 2 channels
Sampling rate                            : 44.1 kHz
Frame rate                               : 38.281 FPS (1152 SPF)
Compression mode                         : Lossy
Stream size                              : 7.01 MiB (99%)
Writing library                          : LAME3.100

Image
Format                                   : JPEG
Width                                    : 500 pixels
Height                                   : 500 pixels
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Compression mode                         : Lossy
Stream size                              : 51.9 KiB (1%)


How can I conserve the comment tag?

-Ulf



More information about the ffmpeg-user mailing list