BUG: received signal SIGFPE, Arithmetic exception 
Using last snapshot ( motion-3.1.18_snap8 ) with ffmpeg-0.4.8 compiled from source and  with logitech Sphere ( pwc-10.0.5 ). 
modprobe pwc size=vga mbufs=3 fps=10
  Test case 
settings:
image width 640 height 480
or
image width 320 height 240
gdb bt trace (width 640 height 480):
Program received signal SIGFPE, Arithmetic exception.
[Switching to Thread 1087982512 (LWP 5563)]
0x402e00a9 in ff_fix_long_b_mvs () from /usr/local/lib/libavcodec.so
(gdb) bt full
#0  0x402e00a9 in ff_fix_long_b_mvs () from /usr/local/lib/libavcodec.so
No symbol table info available.
#1  0x402d4d12 in ff_estimate_b_frame_motion () from /usr/local/lib/libavcodec.so
No symbol table info available.
#2  0x4027ce95 in ff_combine_frame () from /usr/local/lib/libavcodec.so
No symbol table info available.
#3  0x40279649 in MPV_encode_picture () from /usr/local/lib/libavcodec.so
No symbol table info available.
#4  0x402767aa in avcodec_encode_video () from /usr/local/lib/libavcodec.so
No symbol table info available.
#5  0x08058337 in ffmpeg_put_frame (ffmpeg=0x80775a8, pic=0x1) at ffmpeg.c:493
        out_size = 0
        ret = 0
#6  0x0805829e in ffmpeg_put_other_image (ffmpeg=0x8076630, y=0x0, u=0x0, v=0x0) at ffmpeg.c:462
        picture = (AVFrame *) 0x8100ad0
#7  0x080533cc in event_ffmpeg_put (type=256, cnt=0x8065568,
    img=0x416e8008 "ttuwyz{|yqutqv|\200{oty}{yw~{z|~{{\200\202\206{w~\200\203\205\205\201}{{|\200\204\203\203~w\200\177}|\212\216\214\205\204\206\207\210\204\205vu\202\210\215\216\206\205\203\201\201|wq\201Ãõñääääããããåäãâèèèèáâäæèèéêççççåæçèêêêêééééçèéêêêêêééééêêêêçèéêèèèèëêéééééééééé", 'è' <repeats 16 times>, "æåäãèèèèèèèèäåæçèèèèçççç"..., dummy2=0x0, tm=0x40d94a90)
    at event.c:468
        width = 640
        height = 0
        u = (unsigned char *) 0x1 <Address 0x1 out of bounds>
        v = (unsigned char *) 0x0
#8  0x080535b4 in event (type=256, cnt=0x8065568,
    filename=0x416e8008 "ttuwyz{|yqutqv|\200{oty}{yw~{z|~{{\200\202\206{w~\200\203\205\205\201}{{|\200\204\203\203~w\200\177}|\212\216\214\205\204\206\207\210\204\205vu\202\210\215\216\206\205\203\201\201|wq\201Ãõñääääããããåäãâèèèèáâäæèèéêççççåæçèêêêêééééçèéêêêêêééééêêêêçèéêèèèèëêéééééééééé", 'è' <repeats 16 times>, "æåäãèèèèèèèèäåæçèèèèçççç"..., eventdata=0x0,
    tm=0x40d94a90) at event.c:601
        i = 10
#9  0x0804afef in motion_detected (cnt=0x8065568, diffs=3354, dev=0, devpipe=0, devmpipe=0,
    newimg=0x416e8008 "ttuwyz{|yqutqv|\200{oty}{yw~{z|~{{\200\202\206{w~\200\203\205\205\201}{{|\200\204\203\203~w\200\177}|\212\216\214\205\204\206\207\210\204\205vu\202\210\215\216\206\205\203\201\201|wq\201Ãõñääääããããåäãâèèèèáâäæèèéêççççåæçèêêêêééééçèéêêêêêééééêêêêçèéêèèèèëêéééééééééé", 'è' <repeats 16 times>, "æåäãèèèèèèèèäåæçèèèèçççç"...) at motion.c:289
        i = 3354
        tmpshots = 0
        tmptime = {tm_sec = 636, tm_min = 66, tm_hour = 0, tm_mday = 629, tm_mon = 6, tm_year = 11, tm_wday = 0,
  tm_yday = 0, tm_isdst = 1087974028, tm_gmtoff = 470, tm_zone = 0x40d929e8 "ØJÙ@^À\004\bhU\006\b\032\r"}
        conf = (struct config *) 0x8065d70
---Type <return> to continue, or q <return> to quit---
        imgs = (struct images *) 0x8065ee0
     #10 0x0804c05e in motion_loop (arg=0x8065568) at motion.c:748
        olddiffs = 1087974016
        newimg = (
    unsigned char *) 0x416e8008 "ttuwyz{|yqutqv|\200{oty}{yw~{z|~{{\200\202\206{w~\200\203\205\205\201}{{|\200\204\203\203~w\200\177}|\212\216\214\205\204\206\207\210\204\205vu\202\210\215\216\206\205\203\201\201|wq\201Ãõñääääããããåäãâèèèèáâäæèèéêççççåæçèêêêêééééçèéêêêêêééééêêêêçèéêèèèèëêéééééééééé", 'è' <repeats 16 times>, "æåäãèèèèèèèèäåæçèèèèçççç"...
        cnt = (struct context *) 0x8065568
        i = 1087974016
        j = 0
        diffs = 3354
        detecting_motion = 5
        curtime = {tm_sec = 35, tm_min = 10, tm_hour = 11, tm_mday = 15, tm_mon = 11, tm_year = 104, tm_wday = 3,
  tm_yday = 349, tm_isdst = 0, tm_gmtoff = 3600, tm_zone = 0x80675f8 "CET"}
        lastframe = 1103105435
        picture = (FILE *) 0x8065568
        postcap = 0
        frame_buffer_size = 0
        smartmask_ratio = 110
        smartmask_count = 20
        smartmask_lastrate = 2
        passflag = 1
        rolling_average_data = (long int *) 0x8065338
        required_frame_time = 500000
        frame_delay = 0
        rolling_frame = 12
        tv1 = {tv_sec = 1103105435, tv_usec = 435697}
        tv2 = {tv_sec = 1103105434, tv_usec = 999433}
        rolling_average = 0
        elapsedtime = 1087974016
        timenow = 3215000241
        timebefore = 3214494284
#11 0x400469b4 in start_thread () from /lib/tls/libpthread.so.0   location = {x = 609, y = 319, width = 60, height = 80}
gdb bt trace (width 320 height 240):
Program received signal SIGFPE, Arithmetic exception.
[Switching to Thread 1087982512 (LWP 5592)]
0x402e00a9 in ff_fix_long_b_mvs () from /usr/local/lib/libavcodec.so
(gdb) bt full
#0  0x402e00a9 in ff_fix_long_b_mvs () from /usr/local/lib/libavcodec.so
No symbol table info available.
#1  0x402d4d12 in ff_estimate_b_frame_motion () from /usr/local/lib/libavcodec.so
No symbol table info available.
#2  0x4027ce95 in ff_combine_frame () from /usr/local/lib/libavcodec.so
No symbol table info available.
#3  0x40279649 in MPV_encode_picture () from /usr/local/lib/libavcodec.so
No symbol table info available.
#4  0x402767aa in avcodec_encode_video () from /usr/local/lib/libavcodec.so
No symbol table info available.
#5  0x08058337 in ffmpeg_put_frame (ffmpeg=0x81caa38, pic=0x1) at ffmpeg.c:493
        out_size = 0
        ret = 0
#6  0x0805829e in ffmpeg_put_other_image (ffmpeg=0x8067238, y=0x0, u=0x0, v=0x0) at ffmpeg.c:462
        picture = (AVFrame *) 0x81efc90
#7  0x080533cc in event_ffmpeg_put (type=256, cnt=0x8065568,
    img=0x80f8408 "ppqsiottroostsrq{xwyx|ww\200ty{z\177{z}q\206\202z\177oqÉñâããååãååâæææææåæçèèèèèççççèèèèåæçèææææäèååèçææååååååååçççç", 'æ' <repeats 24 times>, "âãäåææææææææääääåããåååååääääääääããããääääããããááááááááããããááááààààÞßâàßßßßßßßß"...,
    dummy2=0x0, tm=0x40d94a90) at event.c:468
        width = 320
        height = 0
        u = (unsigned char *) 0x1 <Address 0x1 out of bounds>
        v = (unsigned char *) 0x0
#8  0x080535b4 in event (type=256, cnt=0x8065568,
    filename=0x80f8408 "ppqsiottroostsrq{xwyx|ww\200ty{z\177{z}q\206\202z\177oqÉñâããååãååâæææææåæçèèèèèççççèèèèåæçèææææäèååèçææååååååååçççç", 'æ' <repeats 24 times>, "âãäåææææææææääääåããåååååääääääääããããääääããããááááááááããããááááààààÞßâàßßßßßßßß"...,
    eventdata=0x0, tm=0x40d94a90) at event.c:601
        i = 10
#9  0x0804afef in motion_detected (cnt=0x8065568, diffs=1960, dev=0, devpipe=0, devmpipe=0,
    newimg=0x80f8408 "ppqsiottroostsrq{xwyx|ww\200ty{z\177{z}q\206\202z\177oqÉñâããååãååâæææææåæçèèèèèççççèèèèåæçèææææäèååèçææååååååååçççç", 'æ' <repeats 24 times>, "âãäåææææææææääääåããåååååääääääääããããääääããããááááááááããããááááààààÞßâàßßßßßßßß"...)
    at motion.c:289
        i = 1960
        tmpshots = 0
        tmptime = {tm_sec = 316, tm_min = 66, tm_hour = 0, tm_mday = 309, tm_mon = 6, tm_year = 11, tm_wday = 0,
  tm_yday = 0, tm_isdst = 1087974028, tm_gmtoff = 230, tm_zone = 0x40d929e8 "ØJÙ@^À\004\bhU\006\bš\a"}
        conf = (struct config *) 0x8065d70
        imgs = (struct images *) 0x8065ee0
        location = {x = 57, y = 225, width = 64, height = 35}
---Type <return> to continue, or q <return> to quit---
#10 0x0804c05e in motion_loop (arg=0x8065568) at motion.c:748
        olddiffs = 1087974016
        newimg = (
    unsigned char *) 0x80f8408 "ppqsiottroostsrq{xwyx|ww\200ty{z\177{z}q\206\202z\177oqÉñâããååãååâæææææåæçèèèèèççççèèèèåæçèææææäèååèçææååååååååçççç", 'æ' <repeats 24 times>, "âãäåææææææææääääåããåååååääääääääããããääääããããááááááááããããááááààààÞßâàßßßßßßßß"...
        cnt = (struct context *) 0x8065568
        i = 1087974016
        j = 0
        diffs = 1960
        detecting_motion = 2
        curtime = {tm_sec = 50, tm_min = 33, tm_hour = 11, tm_mday = 15, tm_mon = 11, tm_year = 104, tm_wday = 3,
  tm_yday = 349, tm_isdst = 0, tm_gmtoff = 3600, tm_zone = 0x80675f8 "CET"}
        lastframe = 1103106830
        picture = (FILE *) 0x8065568
        postcap = 0
        frame_buffer_size = 0
        smartmask_ratio = 110
        smartmask_count = 20
        smartmask_lastrate = 2
        passflag = 1
        rolling_average_data = (long int *) 0x8065338
        required_frame_time = 500000
        frame_delay = 0
        rolling_frame = 1
        tv1 = {tv_sec = 1103106830, tv_usec = 222153}
        tv2 = {tv_sec = 1103106829, tv_usec = 723727}
        rolling_average = 0
        elapsedtime = 1087974016
        timenow = 314819401
        timebefore = 314316483
#11 0x400469b4 in start_thread () from /lib/tls/libpthread.so.0
That is not happening with previous snapshot ( motion-3.1.18_snap7 ) so maybe is related to last patches i guess that ffmpeg ones.
  Environment 
	
		
			|  Motion version:  | 
			 3.1.18_snap8  | 
		
		
			|  Shared libraries:  | 
			 curl, xmlrpc, ffmpeg, mysql, postgresql  | 
		
		
			|  Server OS:  | 
			 debian Sarge, kernel 2.6.8  | 
		
	
-- 
AngelCarpintero - 15 Dec 2004
  Follow up 
  Fix record 
 It happens if you compiled ffmpeg with the option --disable-risky , so avoid to run configure with this option if you compile ffmpeg from source.