Zoneminder branch various patches + fix and plugins

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
nextime
Posts: 23
Joined: Thu Nov 29, 2007 9:20 pm

Zoneminder branch various patches + fix and plugins

Post by nextime »

Hello all.
I'm working on a branch of zoneminder 1.25 that is trying to unify various patches from different contributors.
Actually applied patches are:
* masterofknife's performances patchset
* plugin patches
* updated support for latest ffmpeg version
* various fixes
And plugins:
* face detection plugin
* license plate recognition plugin (alpha version)

The compiling instructions are identical to the one of the masterofknife's branch: http://www.zoneminder.com/forums/viewto ... =9&t=17652

The sources (SVN) are here: https://svn.unixmedia.net/public/zum/trunk/zum/

Also, there are some fundraising about improvements and other developements: http://domotika.unixmedia.net/en/open-s ... nto-targhe
christophe_y2k
Posts: 102
Joined: Mon Oct 12, 2009 8:47 am
Location: EUROPE-FRANCE-MANDELIEU

Re: Zoneminder branch various patches + fix and plugins

Post by christophe_y2k »

Hello,
i try your zm branch, but have compilation error
after download your svn revision 141 and "./configure.." "autoreconf" and "make" ....

Code: Select all

make[2] : on entre dans le répertoire « /usr/share/zoneminder/src »
g++ -DHAVE_CONFIG_H -I. -I..  -I/usr/include -I/usr/include -D__STDC_CONSTANT_MACROS -Wall  -finline-functions -fomit-frame-pointer -I/usr/include -D__STDC_CONSTANT_MACROS   -g -O2 -MT zm_local_camera.o -MD -MP -MF .deps/zm_local_camera.Tpo -c -o zm_local_camera.o zm_local_camera.cpp
zm_local_camera.cpp: In member function ‘void LocalCamera::Terminate()’:
zm_local_camera.cpp:1051:49: erreur: invalid conversion from ‘__u32’ to ‘v4l2_buf_type’
zm_local_camera.cpp: In member function ‘virtual int LocalCamera::PrimeCapture()’:
zm_local_camera.cpp:1934:49: erreur: invalid conversion from ‘__u32’ to ‘v4l2_buf_type’
make[2]: *** [zm_local_camera.o] Erreur 1
make[2] : on quitte le répertoire « /usr/share/zoneminder/src »
make[1]: *** [all-recursive] Erreur 1
make[1] : on quitte le répertoire « /usr/share/zoneminder »
make: *** [all] Erreur 2
i found another patch for this previous error in zm_local_camera.cpp here:

http://svnweb.mageia.org/packages/caul ... ew=markup

- Patch to work around v4l2 api breakage in 3.5 kernel

Code: Select all

+++src/zm_local_camera.cpp	2012-09-11 12:41:09.725153941 +0100
@@ -1048,7 +1048,8 @@
-        enum v4l2_buf_type type = v4l2_data.fmt.type;
+//        enum v4l2_buf_type type = v4l2_data.fmt.type;
+	enum v4l2_buf_type type = (v4l2_buf_type)v4l2_data.fmt.type;
@@ -1931,7 +1932,8 @@
-        enum v4l2_buf_type type = v4l2_data.fmt.type;
+//        enum v4l2_buf_type type = v4l2_data.fmt.type;
+	enum v4l2_buf_type type = (v4l2_buf_type)v4l2_data.fmt.type;
and now after recompile another bug :

Code: Select all

g++ -DHAVE_CONFIG_H -I. -I..  -I/usr/include -I/usr/include -D__STDC_CONSTANT_MACROS -Wall  -finline-functions -fomit-frame-pointer -I/usr/include -D__STDC_CONSTANT_MACROS   -D__STDC_CONSTANT_MACROS -MT zm_mpeg.o -MD -MP -MF .deps/zm_mpeg.Tpo -c -o zm_mpeg.o zm_mpeg.cpp
zm_mpeg.cpp: In function ‘int encode_frame(AVCodecContext*, AVFrame*)’:
zm_mpeg.cpp:38:60: erreur: ‘avcodec_encode_video2’ was not declared in this scope
make[2]: *** [zm_mpeg.o] Erreur 1
make[2] : on quitte le répertoire « /usr/share/zoneminder/src »
make[1]: *** [all-recursive] Erreur 1
make[1] : on quitte le répertoire « /usr/share/zoneminder »
make: *** [all] Erreur 2
If you found another patch for zm_mpeg.cpp ...
thanks you
mobil1
Posts: 7
Joined: Fri Oct 19, 2012 9:21 am

Re: Zoneminder branch various patches + fix and plugins

Post by mobil1 »

hello
my memory is

Code: Select all

             total       used       free     shared    buffers     cached
Mem:      32824236   32524936     299300          0      61984   25451128
my cpu is

Code: Select all

clflush size    : 64
cache_alignment : 64
address sizes   : 46 bits physical, 48 bits virtual
power management:

processor       : 15
vendor_id       : GenuineIntel
cpu family      : 6
model           : 45
model name      : Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz
stepping        : 7
cpu MHz         : 1995.044
cache size      : 20480 KB
physical id     : 0
siblings        : 16
core id         : 7
cpu cores       : 8
apicid          : 15
initial apicid  : 15
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 x2apic popcnt aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid
bogomips        : 3990.08
clflush size    : 64
cache_alignment : 64
address sizes   : 46 bits physical, 48 bits virtual
power management:
my question is
will it help me your patch for 63 cameras that I stand now? and the memory is filled almost completely, although it lived up to 15 cameras at 2GB , so there should be about 8 GB , not 32 GB full. I use zm 1.24.4, and what advice would you give the value or shmmax shmmal.
nextime
Posts: 23
Joined: Thu Nov 29, 2007 9:20 pm

Re: Zoneminder branch various patches + fix and plugins

Post by nextime »

christophe_y2k wrote: http://svnweb.mageia.org/packages/caul ... ew=markup

Code: Select all

+++src/zm_local_camera.cpp	2012-09-11 12:41:09.725153941 +0100
@@ -1048,7 +1048,8 @@
-        enum v4l2_buf_type type = v4l2_data.fmt.type;
+//        enum v4l2_buf_type type = v4l2_data.fmt.type;
+	enum v4l2_buf_type type = (v4l2_buf_type)v4l2_data.fmt.type;
@@ -1931,7 +1932,8 @@
-        enum v4l2_buf_type type = v4l2_data.fmt.type;
+//        enum v4l2_buf_type type = v4l2_data.fmt.type;
+	enum v4l2_buf_type type = (v4l2_buf_type)v4l2_data.fmt.type;
This is applied in trunk revision 142
christophe_y2k wrote: and now after recompile another bug :

Code: Select all

g++ -DHAVE_CONFIG_H -I. -I..  -I/usr/include -I/usr/include -D__STDC_CONSTANT_MACROS -Wall  -finline-functions -fomit-frame-pointer -I/usr/include -D__STDC_CONSTANT_MACROS   -D__STDC_CONSTANT_MACROS -MT zm_mpeg.o -MD -MP -MF .deps/zm_mpeg.Tpo -c -o zm_mpeg.o zm_mpeg.cpp
zm_mpeg.cpp: In function ‘int encode_frame(AVCodecContext*, AVFrame*)’:
zm_mpeg.cpp:38:60: erreur: ‘avcodec_encode_video2’ was not declared in this scope
make[2]: *** [zm_mpeg.o] Erreur 1
make[2] : on quitte le répertoire « /usr/share/zoneminder/src »
make[1]: *** [all-recursive] Erreur 1
make[1] : on quitte le répertoire « /usr/share/zoneminder »
make: *** [all] Erreur 2
If you found another patch for zm_mpeg.cpp ...
thanks you
This was related to an erroneous version of AVLIB where i switched from avcodec_encode_video() to avcodec_encode_video2(). It should be fixed too in the revision 142. Thanks for you feedback!
nextime
Posts: 23
Joined: Thu Nov 29, 2007 9:20 pm

Re: Zoneminder branch various patches + fix and plugins

Post by nextime »

mobil1 wrote:hello


my question is
will it help me your patch for 63 cameras that I stand now? and the memory is filled almost completely, although it lived up to 15 cameras at 2GB , so there should be about 8 GB , not 32 GB full. I use zm 1.24.4, and what advice would you give the value or shmmax shmmal.
From the memory point of view, don't expect anything. and 63 cameras for such server is a very large number in my opinion. Anyway, from the CPU load point of view, you can for sure benefit from the masteroftheknofe's patches included also in this branch.
christophe_y2k
Posts: 102
Joined: Mon Oct 12, 2009 8:47 am
Location: EUROPE-FRANCE-MANDELIEU

Re: Zoneminder branch various patches + fix and plugins

Post by christophe_y2k »

Hello Nextime and many thanks for your reply
but with the latest SVN (REVISION 143)
return same compile error

Code: Select all

# rm -R /usr/share/zoneminder
# svn co https://svn.unixmedia.net/public/zum/trunk/zum/ /usr/share/zoneminder
# cd /usr/share/zoneminder
# autoreconf

# ./configure --prefix=/usr --with-webhost=zoneminder --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --libdir=/usr/lib64 --with-libarch=lib64 --with-mysql=/usr --with-ffmpeg=/usr --with-webdir=/var/www/zoneminder/htdocs --with-cgidir=/var/www/zoneminder/cgi-bin --with-webuser=apache --with-webgroup=apache --enable-debug=no --enable-crashtrace=no --enable-mmap=yes ZM_DB_HOST=localhost ZM_DB_NAME=zm ZM_DB_USER=zmuser ZM_DB_PASS=zmpass CXXFLAGS=-D__STDC_CONSTANT_MACROS

# make
make error:

Code: Select all

g++ -DHAVE_CONFIG_H -I. -I..  -I/usr/include -I/usr/include -D__STDC_CONSTANT_MACROS -Wall  -finline-functions -fomit-frame-pointer -I/usr/include -D__STDC_CONSTANT_MACROS   -D__STDC_CONSTANT_MACROS -MT zm_mpeg.o -MD -MP -MF .deps/zm_mpeg.Tpo -c -o zm_mpeg.o zm_mpeg.cpp
zm_mpeg.cpp: In function ‘int encode_frame(AVCodecContext*, AVFrame*)’:
zm_mpeg.cpp:38:60: erreur: ‘avcodec_encode_video2’ was not declared in this scope
zm_mpeg.cpp: At global scope:
zm_mpeg.cpp:31:12: attention : ‘int encode_frame(AVCodecContext*, AVFrame*)’ defined but not used
make[2]: *** [zm_mpeg.o] Erreur 1
make[2] : on quitte le répertoire « /usr/share/zoneminder/src »
make[1]: *** [all-recursive] Erreur 1
make[1] : on quitte le répertoire « /usr/share/zoneminder »
make: *** [all] Erreur 2
snif ...
nextime
Posts: 23
Joined: Thu Nov 29, 2007 9:20 pm

Re: Zoneminder branch various patches + fix and plugins

Post by nextime »

Which version of libav have you installed?
nextime
Posts: 23
Joined: Thu Nov 29, 2007 9:20 pm

Re: Zoneminder branch various patches + fix and plugins

Post by nextime »

Ok, hope i found where was the error, a wrong #if of the version of libav in the encode_video() declaration.

Now it should work on revision 144
christophe_y2k
Posts: 102
Joined: Mon Oct 12, 2009 8:47 am
Location: EUROPE-FRANCE-MANDELIEU

Re: Zoneminder branch various patches + fix and plugins

Post by christophe_y2k »

COOL !!! now that compile !!!!

but ....

on older BDD from official v1.25 svn
after
# make
# make install
# make clean
# cd ..
when i start :
# zmupdate.pl

Code: Select all

Bareword "ZM_EVENT_IMAGE_DIGITS" not allowed while "strict subs" in use at /usr/lib64/perl5/site_perl/5.12.4/x86_64-linux/ZoneMinder/General.pm line 437.
BEGIN not safe after errors--compilation aborted at /usr/lib64/perl5/site_perl/5.12.4/x86_64-linux/ZoneMinder/General.pm line 504.
Compilation failed in require at /usr/bin/zmupdate.pl line 49.
BEGIN failed--compilation aborted at /usr/bin/zmupdate.pl line 49
i seen in db source /usr/share/zm/db/zm_update-kfir-to-zum.sql
but i can't inject, have this error

Code: Select all

ERROR 1060 (42S21) at line 22: Duplicate column name 'UsedPl'
and i don't know if i must inject it...

and with fresh new bbd from your svn haven't got this error
but no live image (record are good and jpeg stamp too) on my cam
i suppose this prob from cgi or shm tweaks but my shm are tweaked and cgi-bin path is configured

Code: Select all

[code]
2012-12-15 21:01:44.069785	web_php	24862	ERR	socket_sendto( /tmp/zm/zms-255986s.sock ) failed: No such file or directory	/var/www/zoneminder/htdocs/includes/functions.php	2322
2012-12-15 21:01:35.387870	web_php	24861	ERR	socket_sendto( /tmp/zm/zms-278207s.sock ) failed: No such file or directory	/var/www/zoneminder/htdocs/includes/functions.php	2322
2012-12-15 20:59:18.043056	zma_m1	24815	INF	SALON: 21000 - Processing at 5.49 fps	zm_monitor.cpp	1179
2012-12-15 20:59:17.277178	zmc_m1	24808	INF	SALON: 21000 - Capturing at 5.49 fps	zm_monitor.cpp	2871
2012-12-15 20:56:16.166933	zma_m1	24815	INF	SALON: 20000 - Processing at 5.49 fps	zm_monitor.cpp	1179
ok i omit the "AUTH RELAY" bug... if i unset this and restart all work perfectly !
[/code]

In-Options-System
AUTH_RELAY Method used to relay authentication information (?) [bug]hashed [bug]plain [x]none

rest the prob of upgrading an older official svn bdd..

and and ... i know i know

when i select with filter all my record for deleting
that take a will a will but never terminate and never delete record
this function work on official svn zm

Code: Select all

web_js	13527	ERR	form.elements.autoUpload is undefined	http://192.168.0.3/zoneminder/skins/classic/views/js/filter.js	14

Its time to go to bed for me !!!
bye
nextime
Posts: 23
Joined: Thu Nov 29, 2007 9:20 pm

Re: Zoneminder branch various patches + fix and plugins

Post by nextime »

christophe_y2k wrote: when i start :
# zmupdate.pl

Code: Select all

Bareword "ZM_EVENT_IMAGE_DIGITS" not allowed while "strict subs" in use at /usr/lib64/perl5/site_perl/5.12.4/x86_64-linux/ZoneMinder/General.pm line 437.
BEGIN not safe after errors--compilation aborted at /usr/lib64/perl5/site_perl/5.12.4/x86_64-linux/ZoneMinder/General.pm line 504.
Compilation failed in require at /usr/bin/zmupdate.pl line 49.
BEGIN failed--compilation aborted at /usr/bin/zmupdate.pl line 49
I don't know why exacty you have this error, it's per related more than zm related, but in any way you don't need to run zmupdate from a 1.25 install.
i seen in db source /usr/share/zm/db/zm_update-kfir-to-zum.sql
but i can't inject, have this error

Code: Select all

ERROR 1060 (42S21) at line 22: Duplicate column name 'UsedPl'
and i don't know if i must inject it...
The right sql script coming from 1.25 isn't this but the one called zm_update_1.25.0-to-zum.sql
Anyway, if you alreade have the column UsedPl probabily you already have the right db schema, if you are unsure about that, drop the entire database and then use the script zm_create.sql
and with fresh new bbd from your svn haven't got this error
but no live image (record are good and jpeg stamp too) on my cam
i suppose this prob from cgi or shm tweaks but my shm are tweaked and cgi-bin path is configured

Code: Select all

[code]
2012-12-15 21:01:44.069785	web_php	24862	ERR	socket_sendto( /tmp/zm/zms-255986s.sock ) failed: No such file or directory	/var/www/zoneminder/htdocs/includes/functions.php	2322
2012-12-15 21:01:35.387870	web_php	24861	ERR	socket_sendto( /tmp/zm/zms-278207s.sock ) failed: No such file or directory	/var/www/zoneminder/htdocs/includes/functions.php	2322
2012-12-15 20:59:18.043056	zma_m1	24815	INF	SALON: 21000 - Processing at 5.49 fps	zm_monitor.cpp	1179
2012-12-15 20:59:17.277178	zmc_m1	24808	INF	SALON: 21000 - Capturing at 5.49 fps	zm_monitor.cpp	2871
2012-12-15 20:56:16.166933	zma_m1	24815	INF	SALON: 20000 - Processing at 5.49 fps	zm_monitor.cpp	1179
ok i omit the "AUTH RELAY" bug... if i unset this and restart all work perfectly !
[/code]
So, you can see also the live if you omit auth relay?
Sounds strane, i actually use auth in my installations, and anyway, there are no differences on the auth part ( on the whole view part! ) in this branch and the original zoneminder, so, if you have this issue, you should have the same issue on the original one ( in 1.25 version ).
rest the prob of upgrading an older official svn bdd..
Try dropping the db and then re-creating it
and and ... i know i know

when i select with filter all my record for deleting
that take a will a will but never terminate and never delete record
this function work on official svn zm

Code: Select all

web_js	13527	ERR	form.elements.autoUpload is undefined	http://192.168.0.3/zoneminder/skins/classic/views/js/filter.js	14

Also the filter part isn't changed at all in this branch, is identical to the original one. This branch have changes only in few add to the php part for the new options and on the c++ part of the backend, not in the perl or js side. it sounds very strange you have those issues...
christophe_y2k
Posts: 102
Joined: Mon Oct 12, 2009 8:47 am
Location: EUROPE-FRANCE-MANDELIEU

Re: Zoneminder branch various patches + fix and plugins

Post by christophe_y2k »

Ok my zm bbd was crashed (power loss ) and many record are missing in table
i drop and delete folder event

With your modified SVN of ZoneMinder
i can do a succesfull fresh install from source on my Linux Gentoo 64

I say a big thanks to you NexTime, for your job

Next time i try to send topic with entire detailed procedure for updated Gentoo based on your good svn

Sorry for my badly english....
chriswiggins
Posts: 18
Joined: Fri Sep 28, 2012 2:52 am

Re: Zoneminder branch various patches + fix and plugins

Post by chriswiggins »

Hi Nextime,

Loving your work here. I have tried and tried and only just finally have I found out why the code wasn't compiling on Ubuntu. Your checks inside configure.ac aren't quite right. Here is a diff to show you what I've changed based on the libav9-ftbfs patch that is going to be part of the new Ubuntu release:

+AC_CHECK_LIB(avcodec,avcodec_version,,AC_MSG_WARN(libavcodec.a is required for MPEG streaming))
+AC_CHECK_LIB(avformat,avformat_version,,AC_MSG_WARN(libavformat.a is required for MPEG streaming))

In your SVN, you do the following:

AC_CHECK_LIB(avcodec,avcodec_open,,AC_MSG_WARN(libavcodec.a is required for MPEG streaming))
AC_CHECK_LIB(avformat,av_new_stream,,AC_MSG_WARN(libavformat.a is required for MPEG streaming))

If you can change this and commit that would be really appreciated. Looking forward to working with everyone on this and moving it forward :D

Cheers
Chris
chriswiggins
Posts: 18
Joined: Fri Sep 28, 2012 2:52 am

Re: Zoneminder branch various patches + fix and plugins

Post by chriswiggins »

Hi Nextime,

I'm now getting zma crashes with your wonderful ANPR plugin. Unfortunately the only debug info I get says it exited abnormally. So I am unsure what I should be doing to debug this. Can you provide some insight? I'd like to help out get this as stable as possible.

Cheers
Chris
nextime
Posts: 23
Joined: Thu Nov 29, 2007 9:20 pm

Re: Zoneminder branch various patches + fix and plugins

Post by nextime »

chriswiggins wrote:Hi Nextime,

Loving your work here. I have tried and tried and only just finally have I found out why the code wasn't compiling on Ubuntu. Your checks inside configure.ac aren't quite right. Here is a diff to show you what I've changed based on the libav9-ftbfs patch that is going to be part of the new Ubuntu release:
Thanks Chris, your changes are in svn trunk revision 146
nextime
Posts: 23
Joined: Thu Nov 29, 2007 9:20 pm

Re: Zoneminder branch various patches + fix and plugins

Post by nextime »

chriswiggins wrote:Hi Nextime,

I'm now getting zma crashes with your wonderful ANPR plugin. Unfortunately the only debug info I get says it exited abnormally. So I am unsure what I should be doing to debug this. Can you provide some insight? I'd like to help out get this as stable as possible.

Cheers
Chris
Chris, the ANPR plugin needs a lot of working to be really useable right now. I will come back to write code in the first decade of january, anyway, the first thing to do is to identify if your issue is on the library side or in the zm plugin. To do that, you can compile the library in debug, it will create a binary where you can pass a video ( there are some examples in the sources ) and check if it is working.

I think probably your issue is related to opencv and/or tesseract version.

Did you have an IRC client? if you come in #zoneminder channel on freenode network, we can maybe test it in realtime and try to fix it
Post Reply