Motion-Project / motion

Motion, a software motion detector. Home page: https://motion-project.github.io/
GNU General Public License v2.0
3.62k stars 545 forks source link

Buffer overflow - Can't create timelapse videos #109

Closed af7567 closed 8 years ago

af7567 commented 8 years ago

Since starting to use mrdave motion (for rtsp support), I haven't been able to use the timelapse option that I used to have in the old motion-svn.

I get the error:

[5] [ERR] [ENC] get_oformat: ffmpeg_video_codec option value mpeg1video2016/06/14-timelapse is not supported
[5] [ERR] [EVT] event_ffmpeg_timelapse: ffopen_open error creating (timelapse) file [/export/motion/cam5/2016/06/14-timelapse]: Operation now in progress

It seems to be trying to set the codec to "mpeg1video2016/06/14-timelapse"

My ffmpeg_ settings are:

ffmpeg_output_movies on
ffmpeg_timelapse 120
ffmpeg_timelapse_mode daily
ffmpeg_bps 400000
ffmpeg_variable_bitrate 0
ffmpeg_video_codec mpeg4
ffmpeg_duplicate_frames on

snapshot_interval 1200

locate_motion_mode off
locate_motion_style cross

text_right %Y-%m-%d\n%T-%q
text_left Lounge
text_changes on

target_dir /export/motion/cam5
snapshot_filename lastsnap
picture_filename lastmot
movie_filename %Y/%m/%d/%H%M%S
timelapse_filename %Y/%m/%d-timelapse

I am using motion mrdave master, and ffmpeg 2.6.3 on a slackware 14.1 system.

edit: $ ffmpeg -codecs

....
 D.V.L. mmvideo              American Laser Games MM Video
 D.V.L. motionpixels         Motion Pixels video
 DEV.L. mpeg1video           MPEG-1 video
 DEV.L. mpeg2video           MPEG-2 video (decoders: mpeg2video mpegvideo )
 DEV.L. mpeg4                MPEG-4 part 2 (encoders: mpeg4 libxvid )
 ..V.L. mpegvideo_xvmc       MPEG-1/2 video XvMC (X-Video Motion Compensation)
 D.V.L. msa1                 MS ATC Screen
....
tosiara commented 8 years ago

I believe it is an issue with buffer overflow. This has been reported on a mail list and needs a code fix. Try to look for the following line in sources and increase buffer size from 5 to 6:

char codec_mpeg[5] = "mpeg4";

af7567 commented 8 years ago

Thanks! I found this on line 707 of event.c and changed the 5 to 6 and now it is working. I should have posted a message here when I first had the problem about a year ago :)

I guess I should leave the issue open though since the fix still needs to be applied to the code on github?

tosiara commented 8 years ago

Let's keep the issue open until fix is submitted. Can you update the title with buffer overflow keyword please?

Mr-Dave commented 8 years ago

Merged fix to master