Motion - Motion Write Buffers Patch

Increase write buffer size for writing image files and ffmpegs

Description of Patch

The default write buffers size for fwrite seem to be too small, causing low frame rates. In the case of ffmpegs, we don't buffer the writes at all, which is likely to be REALLY slow...

Installation of Patch

Download the patch file. If it is packed as a gz or tar.gz unpack it first. Then copy it to the motion source directory and issue the command (assuming the patch file is called filename_of_patch_file.diff)

patch < filename_of_patch_file.diff

Then re-build Motion and test the patch.

Change History of Patch

  • 1.0 Initial revision

Discussion and Comments


One possiblilty for this patch is to set the buffer size based on the size of a frame, currently I am just using 1 MB

-- ACraigWest - 18 May 2009

Thanks for the updated version. I'm building it right now and will let you know how it goes.

-- JeffGroves - 29 Jun 2009

Strange, when I retrieve the source from svn, I received the following message:

Checked out revision 444.

But, when I ran ./configure, I received the following message:

Version: trunk-r442

Are these supposed to be in sync, or is my OCD getting the better of me?

-- JeffGroves - 29 Jun 2009

I'm getting logging from motion showing up on all of my tty connections such as:

Jun 28 21:20:00 maggie motion: [2] event_newfile: File of type 2 saved to: /var/www/html/cams/FrontPorch/lastsnap.jpg Jun 28 21:20:00 maggie motion: [1] event_newfile: File of type 2 saved to: /var/www/html/cams/Garage/lastsnap.jpg Jun 28 21:21:00 maggie motion: [2] event_newfile: File of type 2 saved to: /var/www/html/cams/FrontPorch/lastsnap.jpg Jun 28 21:21:00 maggie motion: [1] event_newfile: File of type 2 saved to: /var/www/html/cams/Garage/lastsnap.jpg

Is this something that you added with this patch or something specific to this SVN?

-- JeffGroves - 29 Jun 2009

The logging spam seems to be coming from the version of the SVN itself -- seems someone is enhancing logging options and has broken something along the way...

Back to the topic at hand though, I believe that on my old 550MHz Pentium IV machine running Fedora Core 9 with the following memory available:

$ free -m total used free shared buffers cached Mem: 502 478 23 0 14 166 -/+ buffers/cache: 298 204 Swap: 509 16 493

that I'm seeing (to the untrained eye) about a 20% improvement in frame rate with this patch installed.

-- JeffGroves - 29 Jun 2009

I like this! -- I increased the buffer to 10MB and things definitely seem to be smoother. Where before sudden jump in motion guaranteed reduction in framerate, everything looks smoother now.

-- RomanGaufman - 05 Jul 2009

Going to test it and if there's no issues i will commit to svn .

Please before to submit any patch against current svn version , try to compile doing "make current" , it could report some issues.

Thanks !

-- AngelCarpintero - 08 Jul 2009

Thanks sack, is it safe to say it's good to have you back? smile

-- RomanGaufman - 09 Jul 2009

yah dude ... i'm back , i'll try to do all my best at least to release 3.3.0

-- AngelCarpintero - 09 Jul 2009
Topic revision: r8 - 08 Mar 2010, AngelCarpintero
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.