Motion - Netcam Modulo 16 Patch
You are here: Foswiki>Motion Web>NetcamModulo16Patch (23 Nov 2014, AngelVera)Edit Attach

Netcam Modulo 16 Patch

Uploaded by KennethLavrsen on behalf of PeterHolik who posted it on the mailing list.


Motion cannot handle image dimensions unless they are a multiple of 16.

This is normally not a problem because all normal camera image size are multiples of 16.

But when you use a Netcam which may be the jpeg type the image could be scaled to anything.

Today Motion may fail when connected to such an image.

Description of Patch

The patch introduces a check for mulitiple of 16 and

  • Logs an error message
  • Exits the thread

Installation of Patch

patch < filename

Change History of Patch

Discussion and Comments

The patch came to late to be included in 3.2.2. We want to test it and maybe discuss if this is how we long term want to handle this. Maybe there is a way to make it work?

Patch is put on TWiki so we do not forget it.

-- KennethLavrsen - 13 Aug 2005

I took the liberty of uploading the diff file as well.

Two comments about the patch: Thanks - I forgot that - Kenneth
  1. I would prefer using % 16 vs. & 0x0F, since the former is much easier to understand in the code. They both result in the same assembler code, so increasing clarity has no performance penalty.
  2. Accepting this patch would simplify the rotate feature, since we could use one reverse function always (the fast quad one) instead of choosing one depending on image dimensions.

-- PerJonsson - 13 Aug 2005

Patch has been integrated with the following changes.

Will be in 3.2.4_snap1 and in 20050822 daily.

-- KennethLavrsen - 21 Aug 2005


Could you, please, suggest what one can do if the IP camera spits out video frames with dimensions which are not multiples of 16? E.g. my Airlive OD-2025HD serves frames in 1920x1080.

Is there a way, say, to tell it to ignore few lines of pixels or is there some other workaround?

Of course, I can bring down the resolution of camera to 1280x720 and then it works fine, but it just does not feel right to do so.

-- IanSchwarzwald - 06 Mar 2013

Any other updates on this? I see some have change the value to be 8 in a few files and recompiled, but isn't the value more fundamental than just an arbitrary change? Wondering what performance or other problems may occur. If it does not degrade the operation of motion, why does it exist, and can it be reduced or removed.

Many of my IP cameras I cannot run at full resolution (1080P, 800x600, etc)

-- JimHoward - 28 Dec 2013

Patch is included in GIT version

-- AngelCarpintero - 24 Feb 2014

if the patch was included in GIT version in Feb/2014, what version would that be? because I am still having the problem in Ubuntu 14.04.1, which comes with Motion 3.2.12-4

-- AngelVera - 23 Nov 2014
Topic revision: r11 - 23 Nov 2014, AngelVera
Copyright © 1999-2024 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.