Opened 7 years ago

Last modified 3 years ago

#6532 reopened enhancement

Autodetect cover art codec in mp3

Reported by: alditis Owned by:
Priority: wish Component: avformat
Version: git-master Keywords: mp3 id3v2
Cc: alditis@gmail.com Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

I'm trying to extract a part of a song but I have a problem with a specific song: test.mp3.

% ffmpeg -i test.mp3 -ss 7 -t 15 output.mp3
ffmpeg version 3.3.2-1~16.04.york1 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
  configuration: --prefix=/usr --extra-version='1~16.04.york1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libavresample   3.  5.  0 /  3.  5.  0
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
[mp3 @ 0x55e94c9bc7c0] Skipping 191 bytes of junk at 124672.
[mjpeg @ 0x55e94c9bfc80] No JPEG data found in image
[mp3 @ 0x55e94c9bc7c0] decoding for stream 1 failed
[mp3 @ 0x55e94c9bc7c0] Estimating duration from bitrate, this may be inaccurate
[mp3 @ 0x55e94c9bc7c0] Could not find codec parameters for stream 1 (Video: mjpeg, none(bt470bg/unknown/unknown)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mp3, from 'test.mp3':
  Metadata:
    asncomp         : 0
    asnalbum        : ¨äÂæ@˜Â@¨ÞäÚÊÜèÂ
    asnimg          : ÒÚÂÎÊæ^rr^b`dbbdfbr`d``\ÎÒÌ
    title           : Como Un Huracan
    artist          : Colon, Willie & Ruben Blades
    publisher       : Sony International
    genre           : Salsa
    album           : Tras La Tormenta
    album_artist    : Willie Colón
    track           : 2
    composer        : Rubén Blades
    date            : 1995
  Duration: 00:04:57.14, start: 0.000000, bitrate: 233 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 229 kb/s
    Stream #0:1: Video: mjpeg, none(bt470bg/unknown/unknown), 90k tbr, 90k tbn, 90k tbc
    Metadata:
      comment         : Other
Stream mapping:
  Stream #0:1 -> #0:0 (mjpeg (native) -> png (native))
  Stream #0:0 -> #0:1 (mp3 (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
[mjpeg @ 0x55e94c9c4900] No JPEG data found in image
Error while decoding stream #0:1: Invalid data found when processing input
Too many packets buffered for output stream 0:1.
[libmp3lame @ 0x55e94c9ec8a0] 4 frames left in the queue on closing
Conversion failed!

I noticed that when modifying any metadata in Rhythmbox and then run the command again the problem does not occur.

In this case I changed the artist metadata: Change "&"" by "y"

Before: Colon, Willie & Ruben Blades
After: Colon, Willie y Ruben Blades

To differentiate from "test.mp3" I created a copy of this called "ok.mp3" with the changed artist metadata.

% ffmpeg -i ok.mp3 -ss 7 -t 15 output.mp3
ffmpeg version 3.3.2-1~16.04.york1 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
  configuration: --prefix=/usr --extra-version='1~16.04.york1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libavresample   3.  5.  0 /  3.  5.  0
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
Input #0, mp3, from 'ok.mp3':
  Metadata:
    artist          : Colon, Willie y Ruben Blades
    title           : Como Un Huracan
    album           : Tras La Tormenta
    composer        : Rubén Blades
    track           : 2
    genre           : Salsa
    publisher       : Sony International
    album_artist    : Willie Colón
    date            : 1995
  Duration: 00:05:08.14, start: 0.000000, bitrate: 224 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 221 kb/s
    Stream #0:1: Video: bmp, bgr24, 200x200, 90k tbr, 90k tbn, 90k tbc
    Metadata:
      comment         : Other
Stream mapping:
  Stream #0:1 -> #0:0 (bmp (native) -> png (native))
  Stream #0:0 -> #0:1 (mp3 (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
[mp3 @ 0x556668499260] Frame rate very high for a muxer not efficiently supporting it.
Please consider specifying a lower framerate, a different muxer or -vsync 2
Output #0, mp3, to 'output.mp3':
  Metadata:
    TPE1            : Colon, Willie y Ruben Blades
    TIT2            : Como Un Huracan
    TALB            : Tras La Tormenta
    TCOM            : Rubén Blades
    TRCK            : 2
    TCON            : Salsa
    TPUB            : Sony International
    TPE2            : Willie Colón
    TDRC            : 1995
    TSSE            : Lavf57.71.100
    Stream #0:0: Video: png, rgb24, 200x200, q=2-31, 200 kb/s, 90k fps, 90k tbn, 90k tbc
    Metadata:
      comment         : Other
      encoder         : Lavc57.89.100 png
    Stream #0:1: Audio: mp3 (libmp3lame), 44100 Hz, stereo, s16p
    Metadata:
      encoder         : Lavc57.89.100 libmp3lame
[mp3 @ 0x556668499260] No packets were sent for some of the attached pictures./s speed=14.9x    
frame=    0 fps=0.0 q=0.0 Lsize=     236kB time=00:00:15.02 bitrate= 128.5kbits/s speed=12.9x    
video:0kB audio:235kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.196890%

Change History (9)

comment:1 by alditis, 7 years ago

Cc: alditis@gmail.com added

comment:2 by alditis, 7 years ago

The files weigh 8.7Mb each because of this it is not possible to attach them.

comment:3 by llogan, 7 years ago

You can provide a link to the file using Dropbox or Google Drive or similar.

comment:5 by Matthias Hunstock, 7 years ago

The output shows that it does not have a problem with the metadata, but with the cover art. It seems that by using RhythmBox you also change the format of the CoverArt from JPEG to BMP.

If you dont need the CoverArt then try adding -vn option or -map 0:a to the commandline.

comment:6 by alditis, 6 years ago

Thanks. Now it works!

comment:7 by Carl Eugen Hoyos, 6 years ago

Component: ffmpegavformat
Keywords: mp3 id3v2 added; extract part removed
Priority: normalwish
Reproduced by developer: set
Status: newopen
Summary: Extract a part of a songAutodetect cover art codec in mp3
Type: defectenhancement
Version: git-master

Looks related to ticket #5028

Do I remember correctly that WMP shows correct cover art for both samples?

comment:8 by Elon Musk, 3 years ago

Resolution: needs_more_info
Status: openclosed

File is gone.

comment:9 by Carl Eugen Hoyos, 3 years ago

Analyzed by developer: set
Resolution: needs_more_info
Status: closedreopened

The problem - iirc - is that the mimetype of the attachment is image/jpg but the actually attached image is a bmp and that for example WMP accepts such abominations.

Note: See TracTickets for help on using tickets.