Opened 13 years ago

Closed 13 years ago

#219 closed defect (fixed)

ffmpeg.c crashes for more than 100 output streams

Reported by: Michi Owned by: Michael Niedermayer
Priority: minor Component: ffmpeg
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

I get an bus error while converting 474 images á 32kb with the following cmd-line:

ffmpeg -f image2 -i *.jpg ./a.mp4

Result:

FFmpeg version 0.6.1, Copyright (c) 2000-2010 the FFmpeg developers
  built on Apr 27 2011 00:26:39 with gcc 4.2.1 (Apple Inc. build 5666) (dot 3)
  configuration: --disable-debug --prefix=/usr/local/Cellar/ffmpeg/0.6.1 --enable-shared --enable-pthreads --enable-nonfree --enable-gpl --disable-indev=jack --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libfaad
  libavutil     50.15. 1 / 50.15. 1
  libavcodec    52.72. 2 / 52.72. 2
  libavformat   52.64. 2 / 52.64. 2
  libavdevice   52. 2. 0 / 52. 2. 0
  libswscale     0.11. 0 /  0.11. 0
Input #0, image2, from 'img001.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: mjpeg, yuvj420p, 640x480, 25 tbr, 25 tbn, 25 tbc
[1]    29252 bus error  ffmpeg -f image2 -i *.jpg ./a.mp4

Any ideas what's causing this error and how to get around it? Google wasn't much of a help. I'll attach a sample jpg file.

Attachments (1)

img001.jpg (32.1 KB ) - added by Michi 13 years ago.
Sample JPG file

Download all attachments as: .zip

Change History (7)

by Michi, 13 years ago

Attachment: img001.jpg added

Sample JPG file

comment:1 by Carl Eugen Hoyos, 13 years ago

Please test a newer version and please provide backtrace for crashes as explained on http://ffmpeg.org/bugreports.html

comment:2 by Michi, 13 years ago

UPDATE: changed to ffmpeg_g output

michi at fry in ~/Downloads/ffmpeg on master
± gdb ./ffmpeg_g [11:52] rvm: ruby-1.8.7-p334
GNU gdb 6.3.50-20050815 (Apple version gdb-1518) (Sat Feb 12 02:52:12 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ........... done

(gdb) r -f image2 -i ../20110518/tmp/*.jpg ../20110518/a.mp4
Starting program: /Users/michi/Downloads/ffmpeg/ffmpeg_g -f image2 -i ../20110518/tmp/*.jpg ../20110518/a.mp4
Reading symbols for shared libraries .++++++++++ done
ffmpeg version git-N-30043-g75a37b5, Copyright (c) 2000-2011 the FFmpeg developers

built on May 19 2011 11:43:54 with gcc 4.2.1 (Apple Inc. build 5666) (dot 3)
configuration: --enable-libmp3lame --enable-shared --disable-mmx --arch=x86_64
libavutil 51. 2. 1 / 51. 2. 1
libavcodec 53. 6. 0 / 53. 6. 0
libavformat 53. 1. 0 / 53. 1. 0
libavdevice 53. 0. 0 / 53. 0. 0
libavfilter 2. 5. 0 / 2. 5. 0
libswscale 0. 14. 0 / 0. 14. 0

Input #0, image2, from '../20110518/tmp/img001.jpg':

Duration: 00:00:00.04, start: 0.000000, bitrate: N/A

Stream #0.0: Video: mjpeg, yuvj420p, 640x480, 25 tbr, 25 tbn, 25 tbc

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
0x0000000100006782 in new_output_stream (oc=<value temporarily unavailable, due to optimizations>, file_idx=<value temporarily unavailable, due to optimizations>) at ffmpeg.c:682
682 ost = output_streams_for_file[file_idx][idx] =
(gdb) bt
#0 0x0000000100006782 in new_output_stream (oc=<value temporarily unavailable, due to optimizations>, file_idx=<value temporarily unavailable, due to optimizations>) at ffmpeg.c:682
#1 0x0000000100006fec in new_video_stream (oc=0x100d1f060, file_idx=0) at ffmpeg.c:3524
(gdb) disass $pc-32 $pc+32
Dump of assembler code from 0x100006762 to 0x1000067a2:
0x0000000100006762 <new_output_stream+66>: add %al,(%rax)
0x0000000100006764 <new_output_stream+68>: add %ch,%al
0x0000000100006766 <new_output_stream+70>: out %al,$0xef
0x0000000100006768 <new_output_stream+72>: (bad)
0x0000000100006769 <new_output_stream+73>: decl -0x77(%rcx)
0x000000010000676c <new_output_stream+76>: (bad)
0x000000010000676d <new_output_stream+77>: mov %rax,0x0(%r13,%rbx,8)
0x0000000100006772 <new_output_stream+82>: mov $0x240,%edi
0x0000000100006777 <new_output_stream+87>: callq 0x10000f598 <dyld_stub_av_mallocz>
0x000000010000677c <new_output_stream+92>: mov %rax,%rbx
0x000000010000677f <new_output_stream+95>: movslq %ebp,%rax
0x0000000100006782 <new_output_stream+98>: mov %rbx,(%r12,%rax,8)
0x0000000100006786 <new_output_stream+102>: test %rbx,%rbx
0x0000000100006789 <new_output_stream+105>: je 0x1000067d0 <new_output_stream+176>
0x000000010000678b <new_output_stream+107>: mov %r14d,(%rbx)
0x000000010000678e <new_output_stream+110>: mov %ebp,0x4(%rbx)
0x0000000100006791 <new_output_stream+113>: xor %edx,%edx
0x0000000100006793 <new_output_stream+115>: lea 0xa3ad(%rip),%rsi # 0x100010b47
0x000000010000679a <new_output_stream+122>: lea 0x104ff(%rip),%rax # 0x100016ca0 <sws_opts>
0x00000001000067a1 <new_output_stream+129>: mov (%rax),%rdi
End of assembler dump.
(gdb) info all-registers
rax 0x0 0
rbx 0x100d1f060 4308725856
rcx 0x0 0
rdx 0x240 576
rsi 0x0 0
rdi 0x100d1f2a0 4308726432
rbp 0x0 0x0
rsp 0x7fff5fbf5850 0x7fff5fbf5850
r8 0x100dfc0a0 4309631136
r9 0x100dfc0a4 4309631140
r10 0x2a 42
r11 0x100d1f060 4308725856
r12 0x0 0
r13 0x100016fc0 4295061440
r14 0x68 104
r15 0x0 0
rip 0x100006782 0x100006782 <new_output_stream+98>
eflags 0x10206 66054
cs 0x27 39
ss 0x0 0
ds 0x0 0
es 0x0 0
fs 0x0 0
gs 0x0 0
st0 <invalid float value> (raw 0xffff0000000000000000)
st1 0 (raw 0x00000000000000000000)
st2 0 (raw 0x00000000000000000000)
st3 -1 (raw 0xbfff8000000000000000)
st4 1 (raw 0x3fff8000000000000000)
st5 0.99895315831621804195496541756149611 (raw 0x3ffeffbb64e9343dbabd)
st6 0.0020914946669737078490037456360295387 (raw 0x3ff689117531c4e2b988)
st7 -46.051701859880913733635843243519048 (raw 0xc004b834f1551552d72c)
fctrl 0x37f 895
fstat 0x220 544
ftag 0xffff 65535
fiseg 0x27 39
fioff 0x854d2572 -2058541710
foseg 0x1f 31
fooff 0x5fbf5778 1606375288
fop 0x51c 1308
xmm0 {

v4_float = {0, 0, 0, 0},
v2_double = {0, 0},
v16_int8 = {0 <repeats 16 times>},
v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0},
v4_int32 = {0, 0, 0, 0},
v2_int64 = {0, 0},
uint128 = 0

} (raw 0x00000000000000000000000000000000)
xmm1 {

v4_float = {0, 0, 0, 0},
v2_double = {0, 0},
v16_int8 = {0 <repeats 16 times>},
v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0},
v4_int32 = {0, 0, 0, 0},
v2_int64 = {0, 0},
uint128 = 0

} (raw 0x00000000000000000000000000000000)
xmm2 {

v4_float = {-nan(0x7fffff), -nan(0x7fffff), 1.875, 0},
v2_double = {-nan(0xfffffffffffff), 1},
v16_int8 = {-1, -1, -1, -1, -1, -1, -1, -1, 63, -16, 0, 0, 0, 0, 0, 0},
v8_int16 = {-1, -1, -1, -1, 16368, 0, 0, 0},
v4_int32 = {-1, -1, 1072693248, 0},
v2_int64 = {-1, 4607182418800017408},
uint128 = 0xffffffffffffffff3ff0000000000000

} (raw 0x000000000000f03fffffffffffffffff)
xmm3 {

v4_float = {0, 0, 1.875, 0},
v2_double = {0, 1},
v16_int8 = {0, 0, 0, 0, 0, 0, 0, 0, 63, -16, 0, 0, 0, 0, 0, 0},
v8_int16 = {0, 0, 0, 0, 16368, 0, 0, 0},
v4_int32 = {0, 0, 1072693248, 0},
v2_int64 = {0, 4607182418800017408},
uint128 = 61503

} (raw 0x000000000000f03f0000000000000000)
xmm4 {

v4_float = {4.21855049e-08, 1.53672873e+25, 2.52253898e+14, 2.39077945e+29},
v2_double = {5.1498781820597071e-62, 1.0304351227240633e+113},
v16_int8 = {51, 53, 47, 116, 105, 75, 98, 101, 87, 101, 108, 112, 112, 65, 32, 41},
v8_int16 = {13109, 12148, 26955, 25189, 22373, 27760, 28737, 8233},
v4_int32 = {859123572, 1766548069, 1466264688, 1883316265},
v2_int64 = {3689907646729249381, 6297558884122959913},
uint128 = 0x33352f74694b626557656c7070412029

} (raw 0x29204170706c655765624b69742f3533)
xmm5 {

v4_float = {4.15607711e+21, 1.49230685e-19, 2.050215e-10, 1.89223161e+25},
v2_double = {5.2235847233614282e+170, 1.8368229407782176e-80},
v16_int8 = {99, 97, 77, 40, 32, 48, 46, 53, 47, 97, 108, 108, 105, 122, 111, 77},
v8_int16 = {25441, 19752, 8240, 11829, 12129, 27756, 27002, 28493},
v4_int32 = {1667321128, 540028469, 794913900, 1769631565},
v2_int64 = {7161089717229858357, 3414129205405445965},
uint128 = 0x63614d2820302e352f616c6c697a6f4d

} (raw 0x4d6f7a696c6c612f352e3020284d6163)
xmm6 {

v4_float = {1.21001001e-39, 2.50239676e-40, 1.22200513e-39, 1.19984219e-39},
v2_double = {1.8323263896204137e-308, 1.8504906739258844e-308},
v16_int8 = {0, 13, 45, 4, 0, 2, -71, -111, 0, 13, 78, 116, 0, 13, 16, -84},
v8_int16 = {13, 11524, 2, -18031, 13, 20084, 13, 4268},
v4_int32 = {863492, 178577, 872052, 856236},
v2_int64 = {3708669900536209, 3745434821267628},
uint128 = 0x000d2d040002b991000d4e74000d10ac

} (raw 0xac100d00744e0d0091b90200042d0d00)
xmm7 {

v4_float = {8.47505311e-42, 8.47505311e-42, 8.47505311e-42, 8.47505311e-42},
v2_double = {1.2833830546746076e-310, 1.2833830546746076e-310},
v16_int8 = {0, 0, 23, -96, 0, 0, 23, -96, 0, 0, 23, -96, 0, 0, 23, -96},
v8_int16 = {0, 6048, 0, 6048, 0, 6048, 0, 6048},
v4_int32 = {6048, 6048, 6048, 6048},
v2_int64 = {25975962212256, 25975962212256},
uint128 = 0x000017a0000017a0000017a0000017a0

} (raw 0xa0170000a0170000a0170000a0170000)
xmm8 {

v4_float = {9.80908925e-45, 6.86636248e-44, 7.14662217e-44, 1.12103877e-44},
v2_double = {1.4853970560966123e-313, 1.0822178534318141e-312},
v16_int8 = {0, 0, 0, 7, 0, 0, 0, 49, 0, 0, 0, 51, 0, 0, 0, 8},
v8_int16 = {0, 7, 0, 49, 0, 51, 0, 8},
v4_int32 = {7, 49, 51, 8},
v2_int64 = {30064771121, 219043332104},
uint128 = 0x00000007000000310000003300000008

} (raw 0x08000000330000003100000007000000)
xmm9 {

v4_float = {9.45936159e-39, 1.66223691e-38, 2.00203904e-38, 9.2756906e-39},
v2_double = {1.0236820072151033e-306, 1.4811656120676235e-304},
v16_int8 = {0, 103, 0, -38, 0, -75, 0, 103, 0, -38, 0, -76, 0, 101, 0, -38},
v8_int16 = {103, 218, 181, 103, 218, 180, 101, 218},
v4_int32 = {6750426, 11862119, 14287028, 6619354},
v2_int64 = {28992858915930215, 61362318023655642},
uint128 = 0x006700da00b5006700da00b4006500da

} (raw 0xda006500b400da006700b500da006700)
xmm10 {

v4_float = {1.14906474e-43, 1.14906474e-43, 1.14906474e-43, 1.14906474e-43},
v2_double = {1.7400365489966571e-312, 1.7400365489966571e-312},
v16_int8 = {0, 0, 0, 82, 0, 0, 0, 82, 0, 0, 0, 82, 0, 0, 0, 82},
v8_int16 = {0, 82, 0, 82, 0, 82, 0, 82},
v4_int32 = {82, 82, 82, 82},
v2_int64 = {352187318354, 352187318354},
uint128 = 0x00000052000000520000005200000052

} (raw 0x52000000520000005200000052000000)
xmm11 {

v4_float = {9.11558664e-41, 9.11558664e-41, 9.11558664e-41, 9.11558664e-41},
v2_double = {1.3803794823022139e-309, 1.3803794823022139e-309},
v16_int8 = {0, 0, -2, 27, 0, 0, -2, 27, 0, 0, -2, 27, 0, 0, -2, 27},
v8_int16 = {0, -485, 0, -485, 0, -485, 0, -485},
v4_int32 = {65051, 65051, 65051, 65051},
v2_int64 = {279391917637147, 279391917637147},
uint128 = 0x0000fe1b0000fe1b0000fe1b0000fe1b

} (raw 0x1bfe00001bfe00001bfe00001bfe0000)
xmm12 {

v4_float = {1.1479437e-41, 1.1479437e-41, 1.1479437e-41, 1.1479437e-41},
v2_double = {1.7383389523634897e-310, 1.7383389523634897e-310},
v16_int8 = {0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0},
v8_int16 = {0, 8192, 0, 8192, 0, 8192, 0, 8192},
v4_int32 = {8192, 8192, 8192, 8192},
v2_int64 = {35184372097024, 35184372097024},
uint128 = 0x00002000000020000000200000002000

} (raw 0x00200000002000000020000000200000)
xmm13 {

v4_float = {0, 0, 0, 0},
v2_double = {0, 0},
v16_int8 = {0 <repeats 16 times>},
v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0},
v4_int32 = {0, 0, 0, 0},
v2_int64 = {0, 0},
uint128 = 0

} (raw 0x00000000000000000000000000000000)
xmm14 {

v4_float = {1.1479437e-41, 1.1479437e-41, 1.1479437e-41, 1.1479437e-41},
v2_double = {1.7383389523634897e-310, 1.7383389523634897e-310},
v16_int8 = {0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0},
v8_int16 = {0, 8192, 0, 8192, 0, 8192, 0, 8192},
v4_int32 = {8192, 8192, 8192, 8192},
v2_int64 = {35184372097024, 35184372097024},
uint128 = 0x00002000000020000000200000002000

} (raw 0x00200000002000000020000000200000)
xmm15 {

v4_float = {4.46297866e-39, 3.68770889e-39, 2.07455091e-39, 4.46365829e-39},
v2_double = {9.2326848599264115e-308, 3.1415065483125298e-308},
v16_int8 = {0, 48, -104, -8, 0, 40, 39, -43, 0, 22, -105, 1, 0, 48, -102, -35},
v8_int16 = {48, -26376, 40, 10197, 22, -26879, 48, -25891},
v4_int32 = {3184888, 2631637, 1480449, 3185373},
v2_int64 = {13678989804054485, 6358480041581277},
uint128 = 0x003098f8002827d50016970100309add

} (raw 0xdd9a300001971600d5272800f8983000)
mxcsr 0x1fa0 8096
(gdb)

Last edited 13 years ago by Michi (previous) (diff)

comment:3 by Carl Eugen Hoyos, 13 years ago

Component: FFmpegundetermined
Status: newopen
Version: unspecifiedgit-master

To produce a useful back-trace, please use ffmpeg_g instead of ffmpeg, as explained on http://ffmpeg.org/bugreports.html

comment:5 by Carl Eugen Hoyos, 13 years ago

Component: undeterminedFFmpeg
Priority: normalminor
Reproduced by developer: set
Summary: Bus error while converting images into a movieffmpeg.c crashes for more than 100 output streams

The correct syntax for your use-case is

ffmpeg -i img%03d.jpg a.mp4

comment:6 by Michael Niedermayer, 13 years ago

Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.