Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#2124 closed defect (fixed)

Libmp3 issues with FFmpeg 1.1

Reported by: Atarikid Owned by: Clément Bœsch
Priority: important Component: avformat
Version: git-master Keywords: regression crash
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description (last modified by Carl Eugen Hoyos)

When encoding to mp3 with FFmpeg 1.1 and the source has cover art it always halts with an error.
When you add -vn it works fine. But then you cannot add coverart yourself.

Audio packet of size 417 (starting with 1F009064...) is invalid, writing it anyway.
ffmpeg(878,0x7fff7c80e180) malloc: * error for object 0x103101ee0: pointer being freed was not allocated
* set a breakpoint in malloc_error_break to debug
Abort trap: 6

This issue was not present with FFmpeg 1.01

Terminal output:

atarikids-MacBook-Pro-2:~ atarikid$ /Users/atarikid/Desktop/ffmpeg -i /Users/atarikid/Desktop/06\ If\ I\ should\ lose\ you.mp3 -c:a libmp3lame /Users/atarikid/Desktop/test.mp3
ffmpeg version 1.1 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan  7 2013 22:01:35 with gcc 4.2.1 (GCC) (Apple Inc. build 5666) (dot 3)
  configuration: --prefix=/Volumes/macosxdisk/sw --as=yasm --enable-gpl --enable-pthreads --disable-ffplay --disable-ffserver --disable-shared --enable-static --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-filters --enable-postproc --enable-runtime-cpudetect
  libavutil      52. 13.100 / 52. 13.100
  libavcodec     54. 86.100 / 54. 86.100
  libavformat    54. 59.106 / 54. 59.106
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 32.100 /  3. 32.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[mp3 @ 0x102006600] max_analyze_duration 5000000 reached at 5015510
Input #0, mp3, from '/Users/atarikid/Desktop/06 If I should lose you.mp3':
  Metadata:
    artist          : Orbital
    album           : Blue Album
    track           : 1/10
    encoded_by      : FFmbc 0.7
  Duration: 00:03:56.70, start: 0.000000, bitrate: 135 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
    Stream #0:1: Video: mjpeg, yuvj444p, 512x512 [SAR 72:72 DAR 1:1], 90k tbr, 90k tbn, 90k tbc
    Metadata:
      title           : 
      comment         : Cover (front)
File '/Users/atarikid/Desktop/test.mp3' already exists. Overwrite ? [y/N] y
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 '/Users/atarikid/Desktop/test.mp3':
  Metadata:
    TPE1            : Orbital
    TALB            : Blue Album
    TRCK            : 1/10
    TENC            : FFmbc 0.7
    TSSE            : Lavf54.59.106
    Stream #0:0: Video: png, rgb24, 512x512 [SAR 1:1 DAR 1:1], q=2-31, 200 kb/s, 90k tbn, 90k tbc
    Metadata:
      title           : 
      comment         : Cover (front)
    Stream #0:1: Audio: mp3, 44100 Hz, stereo, s16p
Stream mapping:
  Stream #0:1 -> #0:0 (mjpeg -> png)
  Stream #0:0 -> #0:1 (mp3 -> libmp3lame)
Press [q] to stop, [?] for help
frame=    1 fps=0.0 q=0.0 size=       0kB time=00:00:23.22 bitrate=   0.0kbits/sframe=    1 fps=1.0 q=0.0 size=       0kB time=00:00:46.13 bitrate=   0.0kbits/sframe=    1 fps=0.7 q=0.0 size=       0kB time=00:01:09.82 bitrate=   0.0kbits/sframe=    1 fps=0.5 q=0.0 size=       0kB time=00:01:33.10 bitrate=   0.0kbits/sframe=    1 fps=0.4 q=0.0 size=       0kB time=00:01:55.38 bitrate=   0.0kbits/sframe=    1 fps=0.3 q=0.0 size=       0kB time=00:02:16.20 bitrate=   0.0kbits/sframe=    1 fps=0.3 q=0.0 size=       0kB time=00:02:37.36 bitrate=   0.0kbits/sframe=    1 fps=0.2 q=0.0 size=       0kB time=00:03:00.89 bitrate=   0.0kbits/sframe=    1 fps=0.2 q=0.0 size=       0kB time=00:03:24.95 bitrate=   0.0kbits/sframe=    1 fps=0.2 q=0.0 size=       0kB time=00:03:49.53 bitrate=   0.0kbits/sAudio packet of size 417 (starting with 1F009064...) is invalid, writing it anyway.
ffmpeg(878,0x7fff7c80e180) malloc: *** error for object 0x103101ee0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6
atarikids-MacBook-Pro-2:~ atarikid$ 

Attachments (1)

The Last Emotion.mp3 (1.3 MB ) - added by Carl Eugen Hoyos 11 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 by Carl Eugen Hoyos, 11 years ago

Keywords: regression crash added
Priority: normalimportant

Please provide (or point to) a sample.

comment:2 by Carl Eugen Hoyos, 11 years ago

Description: modified (diff)

comment:3 by Atarikid, 11 years ago

Just try any source file (mp3) with coverart. If you still need an example file I can upload it offcourse. But as said, every mp3 with coverart triggers this issue.

comment:4 by Carl Eugen Hoyos, 11 years ago

Please provide (or point to) a sample.

comment:5 by Atarikid, 11 years ago

Added an example. ;)

comment:6 by Carl Eugen Hoyos, 11 years ago

Component: FFmpegavformat
Reproduced by developer: set
Status: newopen
Version: 1.1git-master

Regression since 0072116.

$ valgrind ffmpeg_g  -i The\ Last\ Emotion.mp3 -t 1 out.mp3
==10309== Memcheck, a memory error detector
==10309== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==10309== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==10309== Command: ffmpeg_g -i The\ Last\ Emotion.mp3 -t 1 out.mp3
==10309==
ffmpeg version N-48639-g0b68ebc Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan  8 2013 21:33:54 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --disable-indev=jack --enable-libmp3lame
  libavutil      52. 13.100 / 52. 13.100
  libavcodec     54. 86.100 / 54. 86.100
  libavformat    54. 59.106 / 54. 59.106
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 32.100 /  3. 32.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[mp3 @ 0x693dc20] max_analyze_duration 5000000 reached at 5015510
Input #0, mp3, from 'The Last Emotion.mp3':
  Metadata:
    artist          : Anne Clark
    album           : R.S.V.P.
    title           : The Last Emotion
    encoded_by      : FFmbc 0.7
    genre           : New Wave
    date            : 1987
  Duration: 00:02:50.53, start: 0.000000, bitrate: 65 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 64 kb/s
    Stream #0:1: Video: mjpeg, yuvj444p, 168x168 [SAR 72:72 DAR 1:1], 90k tbr, 90k tbn, 90k tbc
    Metadata:
      title           :
      comment         : Cover (front)
[mp3 @ 0x6a433e0] 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 'out.mp3':
  Metadata:
    TPE1            : Anne Clark
    TALB            : R.S.V.P.
    TIT2            : The Last Emotion
    TENC            : FFmbc 0.7
    TCON            : New Wave
    TDRL            : 1987
    TSSE            : Lavf54.59.106
    Stream #0:0: Video: png, rgb24, 168x168 [SAR 1:1 DAR 1:1], q=2-31, 200 kb/s, 90k tbn, 90k tbc
    Metadata:
      title           :
      comment         : Cover (front)
    Stream #0:1: Audio: mp3, 44100 Hz, stereo, s16p
Stream mapping:
  Stream #0:1 -> #0:0 (mjpeg -> png)
  Stream #0:0 -> #0:1 (mp3 -> libmp3lame)
Press [q] to stop, [?] for help
==10309== Invalid read of size 4      0kB time=00:00:00.00 bitrate=N/A    bits/s
==10309==    at 0x52FC1E: mp3_write_audio_packet (mp3enc.c:262)
==10309==    by 0x52FF42: mp3_write_packet (mp3enc.c:314)
==10309==    by 0x540B49: av_interleaved_write_frame (mux.c:497)
==10309==    by 0x45E3D2: write_frame (ffmpeg.c:589)
==10309==    by 0x452882: main (ffmpeg.c:1319)
==10309==  Address 0x6d04c00 is 0 bytes inside a block of size 433 free'd
==10309==    at 0x4C29D4E: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==10309==    by 0x5D4553: av_destruct_packet (avpacket.c:41)
==10309==    by 0x5D4C33: av_free_packet (avpacket.c:178)
==10309==    by 0x540A61: av_interleaved_write_frame (mux.c:756)
==10309==    by 0x45E3D2: write_frame (ffmpeg.c:589)
==10309==    by 0x452882: main (ffmpeg.c:1319)
==10309==
==10309== Invalid read of size 2
==10309==    at 0x4C2C4B0: memcpy@@GLIBC_2.14 (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==10309==    by 0x4DDF88: avio_write (aviobuf.c:181)
==10309==    by 0x55F603: ff_raw_write_packet (rawenc.c:28)
==10309==    by 0x52FC51: mp3_write_audio_packet (mp3enc.c:270)
==10309==    by 0x52FF42: mp3_write_packet (mp3enc.c:314)
==10309==    by 0x540B49: av_interleaved_write_frame (mux.c:497)
==10309==    by 0x45E3D2: write_frame (ffmpeg.c:589)
==10309==    by 0x452882: main (ffmpeg.c:1319)
==10309==  Address 0x6d04c00 is 0 bytes inside a block of size 433 free'd
==10309==    at 0x4C29D4E: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==10309==    by 0x5D4553: av_destruct_packet (avpacket.c:41)
==10309==    by 0x5D4C33: av_free_packet (avpacket.c:178)
==10309==    by 0x540A61: av_interleaved_write_frame (mux.c:756)
==10309==    by 0x45E3D2: write_frame (ffmpeg.c:589)
==10309==    by 0x452882: main (ffmpeg.c:1319)
==10309==
==10309== Invalid read of size 2
==10309==    at 0x4C2C4BE: memcpy@@GLIBC_2.14 (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==10309==    by 0x4DDF88: avio_write (aviobuf.c:181)
==10309==    by 0x55F603: ff_raw_write_packet (rawenc.c:28)
==10309==    by 0x52FC51: mp3_write_audio_packet (mp3enc.c:270)
==10309==    by 0x52FF42: mp3_write_packet (mp3enc.c:314)
==10309==    by 0x540B49: av_interleaved_write_frame (mux.c:497)
==10309==    by 0x45E3D2: write_frame (ffmpeg.c:589)
==10309==    by 0x452882: main (ffmpeg.c:1319)
==10309==  Address 0x6d04c04 is 4 bytes inside a block of size 433 free'd
==10309==    at 0x4C29D4E: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==10309==    by 0x5D4553: av_destruct_packet (avpacket.c:41)
==10309==    by 0x5D4C33: av_free_packet (avpacket.c:178)
==10309==    by 0x540A61: av_interleaved_write_frame (mux.c:756)
==10309==    by 0x45E3D2: write_frame (ffmpeg.c:589)
==10309==    by 0x452882: main (ffmpeg.c:1319)
==10309==
==10309== Invalid read of size 1
==10309==    at 0x4C2C4D0: memcpy@@GLIBC_2.14 (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==10309==    by 0x4DDF88: avio_write (aviobuf.c:181)
==10309==    by 0x55F603: ff_raw_write_packet (rawenc.c:28)
==10309==    by 0x52FC51: mp3_write_audio_packet (mp3enc.c:270)
==10309==    by 0x52FF42: mp3_write_packet (mp3enc.c:314)
==10309==    by 0x540B49: av_interleaved_write_frame (mux.c:497)
==10309==    by 0x45E3D2: write_frame (ffmpeg.c:589)
==10309==    by 0x452882: main (ffmpeg.c:1319)
==10309==  Address 0x6d04da0 is 416 bytes inside a block of size 433 free'd
==10309==    at 0x4C29D4E: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==10309==    by 0x5D4553: av_destruct_packet (avpacket.c:41)
==10309==    by 0x5D4C33: av_free_packet (avpacket.c:178)
==10309==    by 0x540A61: av_interleaved_write_frame (mux.c:756)
==10309==    by 0x45E3D2: write_frame (ffmpeg.c:589)
==10309==    by 0x452882: main (ffmpeg.c:1319)
==10309==
==10309== Invalid free() / delete / delete[] / realloc()
==10309==    at 0x4C29D4E: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==10309==    by 0x5D4553: av_destruct_packet (avpacket.c:41)
==10309==    by 0x5D4C33: av_free_packet (avpacket.c:178)
==10309==    by 0x52FF04: mp3_write_packet (mp3enc.c:316)
==10309==    by 0x540B49: av_interleaved_write_frame (mux.c:497)
==10309==    by 0x45E3D2: write_frame (ffmpeg.c:589)
==10309==    by 0x452882: main (ffmpeg.c:1319)
==10309==  Address 0x6d04c00 is 0 bytes inside a block of size 433 free'd
==10309==    at 0x4C29D4E: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==10309==    by 0x5D4553: av_destruct_packet (avpacket.c:41)
==10309==    by 0x5D4C33: av_free_packet (avpacket.c:178)
==10309==    by 0x540A61: av_interleaved_write_frame (mux.c:756)
==10309==    by 0x45E3D2: write_frame (ffmpeg.c:589)
==10309==    by 0x452882: main (ffmpeg.c:1319)
==10309==
frame=    1 fps=0.1 q=0.0 Lsize=      64kB time=00:00:01.01 bitrate= 517.0kbits/s
video:48kB audio:16kB subtitle:0 global headers:0kB muxing overhead 0.559972%
==10309==
==10309== HEAP SUMMARY:
==10309==     in use at exit: 0 bytes in 0 blocks
==10309==   total heap usage: 76,903 allocs, 76,904 frees, 74,876,390 bytes allocated
==10309==
==10309== All heap blocks were freed -- no leaks are possible
==10309==
==10309== For counts of detected and suppressed errors, rerun with: -v
==10309== ERROR SUMMARY: 211 errors from 5 contexts (suppressed: 2 from 2)

by Carl Eugen Hoyos, 11 years ago

Attachment: The Last Emotion.mp3 added

comment:7 by Clément Bœsch, 11 years ago

Owner: set to Clément Bœsch

Looking into this.

Edit: patch pending on the mailing-list.

Last edited 11 years ago by Clément Bœsch (previous) (diff)

comment:8 by Clément Bœsch, 11 years ago

Resolution: fixed
Status: openclosed

Fixed in 119d70db. Thanks for the report.

comment:9 by Clément Bœsch, 11 years ago

Backported by Carl in the 1.1 branch (fix will be present in 1.1.1).

Note: See TracTickets for help on using tickets.