Opened 10 years ago

Closed 10 years ago

#4003 closed defect (fixed)

Defect in mp3 demuxer when extracting images from id3 tags.

Reported by: c-14 Owned by: Benoit Fouet
Priority: normal Component: avformat
Version: git-master Keywords: mp3
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

When extracting the image from certain mp3s the EOI isn't found correctly and only a part of the image is extracted:
How to reproduce:

C:\Users\Phoenix>C:\ffmpeg-20140916-git-b76d613-win64-static\bin\ffmpeg.exe -i E:\Music\vk\fcb1507af7cb.mp3 -c:v copy C:\test\output.jpeg
ffmpeg version N-66289-gb76d613 Copyright (c) 2000-2014 the FFmpeg developers
  built on Sep 15 2014 22:11:04 with gcc 4.8.3 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
  libavutil      54.  7.100 / 54.  7.100
  libavcodec     56.  1.100 / 56.  1.100
  libavformat    56.  4.101 / 56.  4.101
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  1.100 /  5.  1.100
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  0.100 / 53.  0.100
[mjpeg @ 00000000042b89c0] overread 8
[mjpeg @ 00000000042b89c0] EOI missing, emulating
[mp3 @ 00000000042b7aa0] Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from 'E:\Music\vk\fcb1507af7cb.mp3':
  Metadata:
    TLEN            : 212000
  Duration: 00:03:32.83, start: 0.000000, bitrate: 129 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
    Stream #0:1: Video: mjpeg, yuvj444p(pc, bt470bg), 200x200 [SAR 100:100 DAR 1:1], 90k tbr, 90k tbn, 90k tbc
    Metadata:
      title           :
      comment         : Other
Output #0, image2, to 'C:\test\output.jpeg':
  Metadata:
    TLEN            : 212000
    encoder         : Lavf56.4.101
    Stream #0:0: Video: mjpeg, yuvj444p, 200x200 [SAR 100:100 DAR 1:1], q=2-31,
90k tbn, 90k tbc
    Metadata:
      title           :
      comment         : Other
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=    1 fps=0.0 q=-1.0 Lsize=N/A time=00:00:00.00 bitrate=N/A
video:14kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
ffmpeg version N-66289-gb76d613 Copyright (c) 2000-2014 the FFmpeg developers
built on Sep 15 2014 22:11:04 with gcc 4.8.3 (GCC)

This output doesn't come directly from me, but from a user for whom I'm submitting this bug report. I do have the sample as well and can confirm his findings with that file as far as FFmpeg is concerned. He told me that he was able to correctly extract the image using a different program, so I believe it is a deficiency in FFmpeg and not a problem with the source.

Change History (8)

comment:1 by c-14, 10 years ago

Won't let me attach the file directly to the issue, will upload to the ftp.

[edit]
Have now uploaded it as mp3_demuxer_EOI.mp3

Last edited 10 years ago by c-14 (previous) (diff)

comment:2 by CthUlhUzzz, 10 years ago

Replying to c-14:

Won't let me attach the file directly to the issue, will upload to the ftp.

http://www.datafilehost.com/d/03c7f165

Last edited 10 years ago by CthUlhUzzz (previous) (diff)

comment:3 by CthUlhUzzz, 10 years ago

Owner: set to CthUlhUzzz
Status: newopen

comment:4 by c-14, 10 years ago

Add output with increased loglevel:

ffmpeg started on 2014-10-04 at 20:49:17
Report written to "ffmpeg-20141004-204917.log"
Command line:
"C:\\ffmpeg-20140916-git-b76d613-win64-static\\bin\\ffmpeg.exe" -i "E:\\Music\\vk\\fcb1507af7cb.mp3" -report -c:v copy "C:\\test\\output.jpeg"
ffmpeg version N-66289-gb76d613 Copyright (c) 2000-2014 the FFmpeg developers
  built on Sep 15 2014 22:11:04 with gcc 4.8.3 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
  libavutil      54.  7.100 / 54.  7.100
  libavcodec     56.  1.100 / 56.  1.100
  libavformat    56.  4.101 / 56.  4.101
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  1.100 /  5.  1.100
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  0.100 / 53.  0.100
Splitting the commandline.
Reading option '-i' ... matched as input file with argument 'E:\Music\vk\fcb1507af7cb.mp3'.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option 'C:\test\output.jpeg' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file E:\Music\vk\fcb1507af7cb.mp3.
Successfully parsed a group of options.
Opening an input file: E:\Music\vk\fcb1507af7cb.mp3.
[mp3 @ 0000000002a881a0] Format mp3 probed with size=32768 and score=51
[mp3 @ 0000000002a881a0] id3v2 ver:4 flags:00 len:28662
[mp3 @ 0000000002a881a0] Before avformat_find_stream_info() pos: 28672 bytes read:32768 seeks:0
[mjpeg @ 0000000002a89820] marker=d8 avail_size_in_buf=13964
[mjpeg @ 0000000002a89820] marker parser used 0 bytes (0 bits)
[mjpeg @ 0000000002a89820] marker=e0 avail_size_in_buf=13962
[mjpeg @ 0000000002a89820] marker parser used 16 bytes (128 bits)
[mjpeg @ 0000000002a89820] marker=ec avail_size_in_buf=13944
[mjpeg @ 0000000002a89820] marker parser used 16 bytes (128 bits)
[mjpeg @ 0000000002a89820] marker=ee avail_size_in_buf=13925
[mjpeg @ 0000000002a89820] marker parser used 14 bytes (112 bits)
[mjpeg @ 0000000002a89820] marker=db avail_size_in_buf=13909
[mjpeg @ 0000000002a89820] index=0
[mjpeg @ 0000000002a89820] qscale[0]: 1
[mjpeg @ 0000000002a89820] index=1
[mjpeg @ 0000000002a89820] qscale[1]: 5
[mjpeg @ 0000000002a89820] marker parser used 132 bytes (1056 bits)
[mjpeg @ 0000000002a89820] marker=c0 avail_size_in_buf=13775
[mjpeg @ 0000000002a89820] sof0: picture: 200x200
[mjpeg @ 0000000002a89820] component 0 1:1 id: 0 quant:0
[mjpeg @ 0000000002a89820] component 1 1:1 id: 1 quant:1
[mjpeg @ 0000000002a89820] component 2 1:1 id: 2 quant:1
[mjpeg @ 0000000002a89820] pix fmt id 11111100
[mjpeg @ 0000000002a89820] marker parser used 17 bytes (136 bits)
[mjpeg @ 0000000002a89820] marker=c4 avail_size_in_buf=13756
[mjpeg @ 0000000002a89820] class=0 index=0 nb_codes=10
[mjpeg @ 0000000002a89820] class=0 index=1 nb_codes=9
[mjpeg @ 0000000002a89820] class=1 index=0 nb_codes=226
[mjpeg @ 0000000002a89820] class=1 index=1 nb_codes=242
[mjpeg @ 0000000002a89820] marker parser used 191 bytes (1528 bits)
[mjpeg @ 0000000002a89820] escaping removed 41 bytes
[mjpeg @ 0000000002a89820] marker=da avail_size_in_buf=13563
[mjpeg @ 0000000002a89820] component: 0
[mjpeg @ 0000000002a89820] component: 1
[mjpeg @ 0000000002a89820] component: 2
[mjpeg @ 0000000002a89820] overread 8
[mjpeg @ 0000000002a89820] marker parser used 13523 bytes (108184 bits)
[mjpeg @ 0000000002a89820] EOI missing, emulating
[mjpeg @ 0000000002a89820] decode frame unused 0 bytes
[mp3 @ 0000000002a881a0] max_analyze_duration 5000000 reached at 5015510 microseconds
[mp3 @ 0000000002a881a0] Estimating duration from bitrate, this may be inaccurate
[mp3 @ 0000000002a881a0] After avformat_find_stream_info() pos: 110592 bytes read:131072 seeks:0 frames:195
Input #0, mp3, from 'E:\Music\vk\fcb1507af7cb.mp3':
  Metadata:
    TLEN            : 212000
  Duration: 00:03:32.83, start: 0.000000, bitrate: 129 kb/s
    Stream #0:0, 194, 1/14112000: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
    Stream #0:1, 1, 1/90000: Video: mjpeg, yuvj444p(pc, bt470bg), 200x200 [SAR 100:100 DAR 1:1], 90k tbr, 90k tbn, 90k tbc
    Metadata:
      title           :
      comment         : Other
Successfully opened the file.
Parsing a group of options: output file C:\test\output.jpeg.
Applying option c:v (codec name) with argument copy.
Successfully parsed a group of options.
Opening an output file: C:\test\output.jpeg.
Successfully opened the file.
Output #0, image2, to 'C:\test\output.jpeg':
  Metadata:
    TLEN            : 212000
    encoder         : Lavf56.4.101
    Stream #0:0, 0, 1/90000: Video: mjpeg, yuvj444p, 200x200 [SAR 100:100 DAR 1:1], q=2-31, 90k tbn, 90k tbc
    Metadata:
      title           :
      comment         : Other
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
Press [q] to stop, [?] for help
[AVIOContext @ 0000000002aac740] Statistics: 0 seeks, 1 writeouts
No more output streams to write to, finishing.
frame=    1 fps=0.0 q=-1.0 Lsize=N/A time=00:00:00.00 bitrate=N/A    
 
video:14kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (E:\Music\vk\fcb1507af7cb.mp3):
  Input stream #0:0 (audio): 196 packets read (81920 bytes);
  Input stream #0:1 (video): 1 packets read (13966 bytes);
  Total: 197 packets (95886 bytes) demuxed
Output file #0 (C:\test\output.jpeg):
  Output stream #0:0 (video): 1 packets muxed (13966 bytes);
  Total: 1 packets (13966 bytes) muxed
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0000000002a888e0] Statistics: 3433913 bytes read, 0 seeks

comment:5 by Carl Eugen Hoyos, 10 years ago

Component: undeterminedavformat
Keywords: mp3 added
Reproduced by developer: set

comment:6 by Benoit Fouet, 10 years ago

Owner: changed from CthUlhUzzz to Benoit Fouet

comment:7 by Benoit Fouet, 10 years ago

This is due to the fact that the software creating this mp3 file is using id3v2.3 sizes in an id3v2.4 format. A workaround has been proposed on the mailing list.

comment:8 by Carl Eugen Hoyos, 10 years ago

Resolution: fixed
Status: openclosed

Fixed by Benoit Fouet in 242f8bb3a8a11a54266f43ad45a5a4a260dcbe7f

Note: See TracTickets for help on using tickets.