Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ffmpegfs crashes with free(): invalid next size (normal) on corrupt media files. #96

Closed
dreirund opened this issue Nov 3, 2021 · 3 comments
Assignees
Labels

Comments

@dreirund
Copy link

dreirund commented Nov 3, 2021

I have some media files in my library which are problematic (might be damaged). ffmpegfs crashes on some. However, it should not crash but continue to work (it could give a read error on the problematic file, but not terminate completely).

I have dug down one example.

The crashes were observed with stable release 2.6, the following reports are now done with latest git checkout from 2021-11-03, latest git commit hash: 8bf2856f,
ffmpegfs --version:

-------------------------------------------------------------------------------------------
Built with          : gcc 11.1.0 (linux-gnu)
configuration       : --prefix=/usr --enable-debug

FFMPEGFS Version    : 2.7
FFmpeg Version      : n4.4
Video CD Library    : enabled
DVD Library         : enabled
Bluray Library      : 1.3.0
FUSE library version: 2.9.9
fusermount version: 2.9.9
using FUSE kernel interface version 7.19

I have compiled ffmpegfs with debugging information.

I mount my media library with the following command:
ffmpegfs -o allow_other,ro --max_threads=1 --desttype=MP3 --autocopy=MATCH --profile=FF --level=STANDARD --hwaccel_enc=VAAPI --hwaccel_dec=VAAPI -f -d /home/music /mnt/ffmpegfs/music/

There I have a problematic file, called problematic-file.mp4. It is audio only.

mediainfo problematic-file.mp4 for the original file:

General
Complete name                            : problematic-file.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/mp41)
File size                                : 1.64 MiB
Duration                                 : 3 min 36 s
Overall bit rate mode                    : Variable
Overall bit rate                         : 63.4 kb/s
Writing application                      : Lavf57.41.100

Audio
ID                                       : 1
Format                                   : MPEG Audio
Format version                           : Version 2
Format profile                           : Layer 3
Codec ID                                 : mp4a-69
Duration                                 : 3 min 36 s
Bit rate mode                            : Variable
Bit rate                                 : 62.1 kb/s
Maximum bit rate                         : 65.0 kb/s
Channel(s)                               : 1 channel
Sampling rate                            : 22.05 kHz
Compression mode                         : Lossy
Stream size                              : 1.60 MiB (98%)
Default                                  : Yes
Alternate group                          : 1

ffprobe problematic-file.mp4 for the original file:

ffprobe version n4.4 Copyright (c) 2007-2021 the FFmpeg developers
  built with gcc 11.1.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-shared --enable-version3
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'problematic-file.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf57.41.100
  Duration: 00:03:36.66, start: 0.000000, bitrate: 63 kb/s
  Stream #0:0(und): Audio: mp3 (mp4a / 0x6134706D), 22050 Hz, mono, fltp, 62 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]

Playback of the original file is corrupt; I hear quick clicking noise. Terminal output of ffplay problematic-file.mp4 for the problematic file:

ffplay version n4.4 Copyright (c) 2003-2021 the FFmpeg developers
  built with gcc 11.1.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-shared --enable-version3
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'problematic-file.mp4':/0   
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf57.41.100
  Duration: 00:03:36.66, start: 0.000000, bitrate: 63 kb/s
  Stream #0:0(und): Audio: mp3 (mp4a / 0x6134706D), 22050 Hz, mono, fltp, 62 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
[mp3float @ 0x7f1bf80063c0] Header missing
    Last message repeated 494 times
[mp3float @ 0x7f1bf80063c0] Header missing    0KB sq=    0B f=0/0   
    Last message repeated 187 times
[mp3float @ 0x7f1bf80063c0] Header missing    0KB sq=    0B f=0/0   
    Last message repeated 133 times
[mp3float @ 0x7f1bf80063c0] Header missing    0KB sq=    0B f=0/0   
    Last message repeated 142 times
[mp3float @ 0x7f1bf80063c0] Header missing    0KB sq=    0B f=0/0   
    Last message repeated 3 times
[mp3float @ 0x7f1bf80063c0] Header missing    0KB sq=    0B f=0/0   
    Last message repeated 80 times
[mp3float @ 0x7f1bf80063c0] big_values too big
[mp3float @ 0x7f1bf80063c0] Error while decoding MPEG audio frame.
[mp3float @ 0x7f1bf80063c0] Header missing
    Last message repeated 56 times
[mp3float @ 0x7f1bf80063c0] Header missing    0KB sq=    0B f=0/0   
    Last message repeated 74 times
[mp3float @ 0x7f1bf80063c0] Header missing    0KB sq=    0B f=0/0   
    Last message repeated 121 times
ALSA lib pcm.c:8559:(snd_pcm_recover) underrun occurred  0B f=0/0   

Now, I try to read that file from within the ffmpegfs mount. As soon as I do that (e.g. by mediainfo /mnt/ffmpegfs/music/problematic-file.mp4.mp3), the ffmpegfs process aborts with

free(): invalid next size (normal)
Aborted

The complete terminal output of the ffmpegfs-command from start to abortion is attached [→ here], snippets of the output are the following:

2021-11-04 00:30:24 DEBUG  : Creating media file cache.
FUSE library version: 2.9.9
nullpath_ok: 0
nopath: 0
utime_omit_ok: 0
unique: 2, opcode: INIT (26), nodeid: 0, insize: 56, pid: 0
INIT: 7.34
flags=0x33fffffb
max_readahead=0x00020000
2021-11-04 00:30:24 INFO   : FFMPEGFS V2.7 initialising.
2021-11-04 00:30:24 INFO   : Mapping '/home/music/' to '/mnt/ffmpegfs/music/'.
2021-11-04 00:30:24 DEBUG  : Activating ffmpegfs inter-process link.
2021-11-04 00:30:24 INFO   : Process with PID 15814 is now client, master is PID 29283.
2021-11-04 00:30:24 INFO   : Initialising thread pool with max. 1 threads.
   INIT: 7.19
   flags=0x00000010
   max_readahead=0x00020000
   max_write=0x00020000
   max_background=0
   congestion_threshold=0
   unique: 2, success, outsize: 40
unique: 4, opcode: ACCESS (34), nodeid: 1, insize: 48, pid: 16920
   unique: 4, error: -38 (Function not implemented), outsize: 16
unique: 6, opcode: LOOKUP (1), nodeid: 1, insize: 47, pid: 16920
LOOKUP /.Trash
getattr /.Trash
   unique: 6, error: -2 (No such file or directory), outsize: 16
unique: 8, opcode: LOOKUP (1), nodeid: 1, insize: 52, pid: 16920
LOOKUP /.Trash-1001
getattr /.Trash-1001
   unique: 8, error: -2 (No such file or directory), outsize: 16
unique: 10, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 4239
getattr /
   unique: 10, success, outsize: 120
unique: 12, opcode: OPENDIR (27), nodeid: 1, insize: 48, pid: 15880
   unique: 12, success, outsize: 32
unique: 14, opcode: READDIR (28), nodeid: 1, insize: 80, pid: 15880
readdir[0] from 0
2021-11-04 00:30:40 DEBUG  : [NULL @ 0x7f96d4012e80] Opening '/home/music/problematic-file.mp4' for reading
2021-11-04 00:30:40 DEBUG  : [file @ 0x7f96d4015d00] Setting default whitelist 'file,crypto,data'
2021-11-04 00:30:40 DEBUG  : [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f96d4012e80] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
2021-11-04 00:30:40 DEBUG  : [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f96d4012e80] ISO: File Type Major Brand: isom
2021-11-04 00:30:40 DEBUG  : [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f96d4012e80] Unknown dref type 0x206c7275 size 12
2021-11-04 00:30:40 DEBUG  : [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f96d4012e80] Processing st: 0, edit list 0 - media time: 0, duration: 4777353
2021-11-04 00:30:40 DEBUG  : [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f96d4012e80] Before avformat_find_stream_info() pos: 1715875 bytes read:66658 seeks:1 nb_streams:1
2021-11-04 00:30:40 DEBUG  : [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f96d4012e80] All info found
2021-11-04 00:30:40 DEBUG  : [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f96d4012e80] After avformat_find_stream_info() pos: 70 bytes read:99426 seeks:2 frames:1
2021-11-04 00:30:40 DEBUG  : [AVIOContext @ 0x7f96d401e200] Statistics: 99426 bytes read, 2 seeks
   unique: 14, success, outsize: 4112
unique: 16, opcode: READDIR (28), nodeid: 1, insize: 80, pid: 15880
   unique: 16, success, outsize: 2960
unique: 18, opcode: READDIR (28), nodeid: 1, insize: 80, pid: 15880
   unique: 18, success, outsize: 16
unique: 20, opcode: RELEASEDIR (29), nodeid: 1, insize: 64, pid: 0
   unique: 20, success, outsize: 16
unique: 22, opcode: LOOKUP (1), nodeid: 1, insize: 65, pid: 4239
LOOKUP /problematic-file.mp4.mp3
getattr /problematic-file.mp4.mp3
   NODEID: 2
   unique: 22, success, outsize: 144
unique: 24, opcode: OPEN (14), nodeid: 2, insize: 48, pid: 15881
open flags: 0x8000 /problematic-file.mp4.mp3
2021-11-04 00:30:41 DEBUG  : [/home/music/problematic-file.mp4] Starting decoder thread.
2021-11-04 00:30:41 INFO   : [/home/music/problematic-file.mp4] Transcoding to MP3.
2021-11-04 00:30:41 DEBUG  : [/home/music/problematic-file.mp4] Opening input file.
2021-11-04 00:30:41 DEBUG  : [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f96dc002fc0] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
2021-11-04 00:30:41 DEBUG  : [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f96dc002fc0] ISO: File Type Major Brand: isom
2021-11-04 00:30:41 DEBUG  : [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f96dc002fc0] Unknown dref type 0x206c7275 size 12
2021-11-04 00:30:41 DEBUG  : [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f96dc002fc0] Processing st: 0, edit list 0 - media time: 0, duration: 4777353
2021-11-04 00:30:41 DEBUG  : [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f96dc002fc0] Before avformat_find_stream_info() pos: 1715875 bytes read:136290 seeks:1 nb_streams:1
2021-11-04 00:30:41 DEBUG  : [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f96dc002fc0] All info found
2021-11-04 00:30:41 DEBUG  : [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f96dc002fc0] After avformat_find_stream_info() pos: 70 bytes read:238690 seeks:2 frames:1
2021-11-04 00:30:41 DEBUG  : [/home/music/problematic-file.mp4] Opened input codec for stream #0: MP3 (MPEG audio layer 3)
2021-11-04 00:30:41 DEBUG  : [/home/music/problematic-file.mp4] Audio in: mp3@62.1 kbps 1 Channels 22.050 kHz [03:36.659]
2021-11-04 00:30:41 ERROR  : [/home/felics/.cache/ffmpegfs/cacheidx.sqlite] Failed to execute select: (1) SQL logic error
SELECT filename, desttype, strftime('%s', access_time) FROM cache_entry WHERE strftime('%s', access_time) + 604800 < 1635982241;
2021-11-04 00:30:41 DEBUG  : [/home/music/problematic-file.mp4.mp3] Opening output file.
2021-11-04 00:30:41 DEBUG  : [/home/music/problematic-file.mp4.mp3] Opening format type 'MP3'.
2021-11-04 00:30:41 DEBUG  : [/home/music/problematic-file.mp4.mp3] Opened audio output codec MP3 (MPEG audio layer 3) for stream #0.
2021-11-04 00:30:41 DEBUG  : [/home/music/problematic-file.mp4.mp3] Audio out: mp3@62.1 kbps 1 Channels 22.050 kHz [03:36.659]
2021-11-04 00:30:41 DEBUG  : [/home/felics/.cache/ffmpegfs//mnt/ffmpegfs/music//home/music/problematic-file.mp4.mp3.cache.mp3] Writing cache file.
2021-11-04 00:30:41 DEBUG  : [/home/music/problematic-file.mp4.mp3] Pre-buffering up to 102400 bytes.
[mp3float @ 0x7f96dc007580] Header missing
2021-11-04 00:30:41 ERROR  : [mp3float @ 0x7f96dc007580] Header missing
2021-11-04 00:30:41 ERROR  : [/home/music/problematic-file.mp4] Could not send audio packet at PTS=26122 to decoder (error 'Invalid data found when processing input').
[mp3float @ 0x7f96dc007580] Header missing
2021-11-04 00:30:41 ERROR  : [mp3float @ 0x7f96dc007580] Header missing
2021-11-04 00:30:41 ERROR  : [/home/music/problematic-file.mp4] Could not send audio packet at PTS=78367 to decoder (error 'Invalid data found when processing input').
[...]
[mp3float @ 0x7f96dc007580] Header missing
2021-11-04 00:30:41 ERROR  : [mp3float @ 0x7f96dc007580] Header missing
2021-11-04 00:30:41 ERROR  : [/home/music/problematic-file.mp4] Could not send audio packet at PTS=123167347 to decoder (error 'Invalid data found when processing input').
[mp3float @ 0x7f96dc007580] Header missing
2021-11-04 00:30:41 ERROR  : [mp3float @ 0x7f96dc007580] Header missing
2021-11-04 00:30:41 ERROR  : [/home/music/problematic-file.mp4] Could not send audio packet at PTS=123663673 to decoder (error 'Invalid data found when processing input').
2021-11-04 00:30:41 DEBUG  : [/home/music/problematic-file.mp4.mp3] Creating audio resampler: fltp -> fltp / 44.100 kHz -> 22.050 kHz / stereo -> mono.
2021-11-04 00:30:41 DEBUG  : [SWR @ 0x7f96dc10a9c0] Using fltp internally between filters
2021-11-04 00:30:41 DEBUG  : [SWR @ 0x7f96dc10a9c0] Matrix coefficients:
2021-11-04 00:30:41 DEBUG  : FC:
2021-11-04 00:30:41 DEBUG  : FL:0.707107
2021-11-04 00:30:41 DEBUG  : FR:0.707107
2021-11-04 00:30:41 DEBUG  : 
[mp3float @ 0x7f96dc007580] Header missing
2021-11-04 00:30:41 ERROR  : [mp3float @ 0x7f96dc007580] Header missing
2021-11-04 00:30:41 ERROR  : [/home/music/problematic-file.mp4] Could not send audio packet at PTS=123872653 to decoder (error 'Invalid data found when processing input').
[...]
[mp3float @ 0x7f96dc007580] Header missing
2021-11-04 00:30:42 ERROR  : [mp3float @ 0x7f96dc007580] Header missing
2021-11-04 00:30:42 ERROR  : [/home/music/problematic-file.mp4] Could not send audio packet at PTS=136150204 to decoder (error 'Invalid data found when processing input').
[mp3float @ 0x7f96dc007580] Header missing
2021-11-04 00:30:42 ERROR  : [mp3float @ 0x7f96dc007580] Header missing
2021-11-04 00:30:42 ERROR  : [/home/music/problematic-file.mp4] Could not send audio packet at PTS=136568163 to decoder (error 'Invalid data found when processing input').
free(): invalid next size (normal)
Aborted

Now, a run of the above ffmpegfs call within GDB:
gdb ffmpegfs, on the prompt: run -o allow_other,ro --max_threads=1 --desttype=MP3 --autocopy=MATCH --profile=FF --level=STANDARD --hwaccel_enc=VAAPI --hwaccel_dec=VAAPI -f -d /home/music /mnt/ffmpegfs/music/ to start ffmpegfs with the specified options.

Then I read the problematic file. Output is:

[... similar as above ...]
[mp3float @ 0x7fffcc007580] Header missing
2021-11-04 00:33:59 ERROR  : [mp3float @ 0x7fffcc007580] Header missing
2021-11-04 00:33:59 ERROR  : [/home/music/problematic-file.mp4] Could not send audio packet at PTS=123167347 to decoder (error 'Invalid data found when processing input').
[mp3float @ 0x7fffcc007580] Header missing
2021-11-04 00:33:59 ERROR  : [mp3float @ 0x7fffcc007580] Header missing
2021-11-04 00:33:59 ERROR  : [/home/music/problematic-file.mp4] Could not send audio packet at PTS=123663673 to decoder (error 'Invalid data found when processing input').
2021-11-04 00:33:59 DEBUG  : [/home/music/problematic-file.mp4.mp3] Creating audio resampler: fltp -> fltp / 44.100 kHz -> 22.050 kHz / stereo -> mono.
2021-11-04 00:33:59 DEBUG  : [SWR @ 0x7fffcc0b7ec0] Using fltp internally between filters
2021-11-04 00:33:59 DEBUG  : [SWR @ 0x7fffcc0b7ec0] Matrix coefficients:
2021-11-04 00:33:59 DEBUG  : FC:
2021-11-04 00:33:59 DEBUG  : FL:0.707107
2021-11-04 00:33:59 DEBUG  : FR:0.707107
2021-11-04 00:33:59 DEBUG  : 
[mp3float @ 0x7fffcc007580] Header missing
2021-11-04 00:33:59 ERROR  : [mp3float @ 0x7fffcc007580] Header missing
2021-11-04 00:33:59 ERROR  : [/home/music/problematic-file.mp4] Could not send audio packet at PTS=123872653 to decoder (error 'Invalid data found when processing input').
[...]
[mp3float @ 0x7fffcc007580] Header missing
2021-11-04 00:33:59 ERROR  : [mp3float @ 0x7fffcc007580] Header missing
2021-11-04 00:33:59 ERROR  : [/home/music/problematic-file.mp4] Could not send audio packet at PTS=136568163 to decoder (error 'Invalid data found when processing input').
free(): invalid next size (normal)

Thread 4 "ffmpegfs" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffd7ffe640 (LWP 16430)]
0x00007ffff5961ef5 in raise () from /usr/lib/libc.so.6
(gdb) 

On the (gdb) propt, typing bt for "backtrace":

#0  0x00007ffff5961ef5 in raise () at /usr/lib/libc.so.6
#1  0x00007ffff594b862 in abort () at /usr/lib/libc.so.6
#2  0x00007ffff59a3f38 in __libc_message () at /usr/lib/libc.so.6
#3  0x00007ffff59abbea in  () at /usr/lib/libc.so.6
#4  0x00007ffff59ad2ec in _int_free () at /usr/lib/libc.so.6
#5  0x00007ffff59b0ca8 in free () at /usr/lib/libc.so.6
#6  0x00005555555f4ab1 in FFmpeg_Transcoder::decode_audio_frame(AVPacket*, int*) (this=0x7fffd7ffd010, pkt=0x7fffd7ffcd40, decoded=0x7fffd7ffcca8) at ffmpeg_transcoder.cc:2841
#7  0x00005555555f6b32 in FFmpeg_Transcoder::decode_frame(AVPacket*) (this=0x7fffd7ffd010, pkt=0x7fffd7ffcd40) at ffmpeg_transcoder.cc:3201
#8  0x00005555555f6e64 in FFmpeg_Transcoder::read_decode_convert_and_store(int*) (this=0x7fffd7ffd010, finished=0x7fffd7ffce30) at ffmpeg_transcoder.cc:3616
#9  0x00005555555fb62b in FFmpeg_Transcoder::process_single_fr(int&) (this=this@entry=0x7fffd7ffd010, status=@0x7fffd7ffcf24: 0) at ffmpeg_transcoder.cc:4596
#10 0x00005555555a4c98 in transcoder_thread(void*) (arg=<optimized out>) at transcode.cc:870
#11 0x00005555555de61f in thread_pool::loop_function() (this=0x7fffdc002ac0) at thread_pool.cc:78
#12 0x00007ffff5d483c4 in std::execute_native_thread_routine(void*) (__p=0x7fffdc001220) at /build/gcc/src/gcc/libstdc++-v3/src/c++11/thread.cc:82
#13 0x00007ffff5afd299 in start_thread () at /usr/lib/libpthread.so.0
#14 0x00007ffff5a24053 in clone () at /usr/lib/libc.so.6
(gdb) 

On the (gdb) prompt, typing cont for "continue":

Continuing.
[Thread 0x7fffd7ffe640 (LWP 16430) exited]
[Thread 0x7fffdbfff640 (LWP 16429) exited]
[Thread 0x7fffe5cc2000 (LWP 16419) exited]

Program terminated with signal SIGABRT, Aborted.
The program no longer exists.
(gdb) 

I don't know how I can legally provide the problematic audio file itself; it still might contain copyrighted material. Do you have an idea? (Do you need it at all to investigate the issue?)

ffplay itself does not crash on the problematic audio file.

A manual run of ffmpeg -i problematic-file.mp4 -c mp3 foo.mp3 results in an abortion which seems a sane abortion of ffmpeg and not a crash; full terminal output [→ here], snippets in the following:

ffmpeg version n4.4 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 11.1.0 (GCC)
[...]
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'problematic-file.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf57.41.100
  Duration: 00:03:36.66, start: 0.000000, bitrate: 63 kb/s
  Stream #0:0(und): Audio: mp3 (mp4a / 0x6134706D), 22050 Hz, mono, fltp, 62 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (mp3 (mp3float) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
Output #0, mp3, to 'foo.mp3':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    TSSE            : Lavf58.76.100
  Stream #0:0(und): Audio: mp3, 22050 Hz, mono, fltp (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc58.134.100 libmp3lame
[mp3float @ 0x55c8f743cec0] Header missing/A speed=N/A    
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 0x55c8f743cec0] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 0x55c8f743cec0] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[...]
[mp3float @ 0x55c8f743cec0] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 0x55c8f743cec0] big_values too big
[mp3float @ 0x55c8f743cec0] Error while decoding MPEG audio frame.
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 0x55c8f743cec0] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[...]
[mp3float @ 0x55c8f743cec0] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[libmp3lame @ 0x55c8f743f400] Queue input is backward in time
[mp3float @ 0x55c8f743cec0] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[...]
[mp3float @ 0x55c8f743cec0] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 0x55c8f743cec0] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3 @ 0x55c8f743d300] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 5656666 >= 4196207
[mp3 @ 0x55c8f743d300] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 5656666 >= 4313135
size=       3kB time=00:04:16.53 bitrate=   0.1kbits/s speed=2.25e+03x    
video:0kB audio:3kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 11.141490%
Conversion failed!

(Exitcode: 69.)

A manual run of ffmpeg -i problematic-file.mp4 -c copy foo.mp3 results in the following (full terminal output [→ here], snippets in the following):

ffmpeg version n4.4 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 11.1.0 (GCC)
[...]
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'problematic-file.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf57.41.100
  Duration: 00:03:36.66, start: 0.000000, bitrate: 63 kb/s
  Stream #0:0(und): Audio: mp3 (mp4a / 0x6134706D), 22050 Hz, mono, fltp, 62 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
Output #0, mp3, to 'foo.mp3':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    TSSE            : Lavf58.76.100
  Stream #0:0(und): Audio: mp3 (mp4a / 0x6134706D), 22050 Hz, mono, fltp, 62 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mp3 @ 0x55a4056da300] Audio packet of size 675 (starting with 164C0182...) is invalid, writing it anyway.
[mp3 @ 0x55a4056da300] Audio packet of size 1666 (starting with D6F3AD7C...) is invalid, writing it anyway.
[...]
[mp3 @ 0x55a4056da300] Audio packet of size 1464 (starting with 1E140A7B...) is invalid, writing it anyway.
[mp3 @ 0x55a4056da300] Audio packet of size 1575 (starting with 20080000...) is invalid, writing it anyway.
size=    1643kB time=00:03:34.49 bitrate=  62.7kbits/s speed=2.77e+03x    
video:0kB audio:1643kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.020928%

(Exitcode: 0.)

@nschlia
Copy link
Owner

nschlia commented Nov 4, 2021

Thanks for the report. You've provided a lot information, I guess I can figure out what went wrong without the file. It is correct that you don't send copyrighted material to me.

But if FFmpegfs dropped a core, you could provide it to me.

@nschlia nschlia self-assigned this Nov 4, 2021
@nschlia nschlia added the bug label Nov 4, 2021
@nschlia
Copy link
Owner

nschlia commented Nov 4, 2021

Probably related to issue #92: Different cause for the error, but the repeated error message causes a crash.

@nschlia nschlia closed this as completed in d8ceb33 Nov 5, 2021
@nschlia
Copy link
Owner

nschlia commented Nov 5, 2021

Corrupted input files caused a buffer overrun, fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants