Page 1 of 2

Posted: Sat Apr 25, 2009 10:09 pm
by pbae
Hi,

I identified and solved the problem with mpeg stream on the edimax models. (IC-1500 & IC-1520)
It is now possible to receive stream in mjpeg

Code: Select all

source type: remote
remote hostname: admin:1234@ip.of.cam.era
remote host port: 80
remote host path: /snapshot.cgi
I'm getting ~20 fps at 640x480 resolution (even wireless) :) instead of ~4 fps when using /snapshot.jpg


The problem was the double quotes present within boundary definition sent by the camera.

I modified the source "zm_remote_camera_http.cpp" for both regexp and 'simple" matching to handle facultative double quotes.


Please let me know your prefered way to post the update.

Pascal Baerten

Posted: Sat Apr 25, 2009 11:47 pm
by cordel
As a diff or patch file is preferred as is typical any where.
diff -uN file file.new > Reason.patch

so in your case something like below with the zm version that the patch is for.
diff -uN zm_remote_camera_http.cpp.orig zm_remote_camera_http.cpp > zm_remote_camera_http.cpp_ZM-1.24.1.patch

Just remember to disable HTML in the post so that it don't strip anything out.

1.24.1 patch

Posted: Sun Apr 26, 2009 8:46 am
by pbae
here is the diff:
--- /tmp/zm/src/zm_remote_camera_http.cpp 2009-04-26 10:12:26.000000000 +0200
+++ /usr/src/zm/src/zm_remote_camera_http.cpp 2009-04-26 10:18:25.000000000 +0200
@@ -283,7 +283,7 @@
}

if ( !content_type_expr )
- content_type_expr = new RegExpr( "Content-type: ?(.+?)(?:; ?boundary=(.+?))?\r?\n", PCRE_CASELESS );
+ content_type_expr = new RegExpr( "Content-type: ?(.+?)(?:; ?boundary=\x22?(.+?)\x22?)?\r?\n", PCRE_CASELESS );
if ( content_type_expr->Match( header, header_len ) >= 2 )
{
content_type = content_type_expr->MatchString( 1 );
@@ -712,8 +712,10 @@
if ( strncasecmp( start_ptr, boundary_match, boundary_match_len ) == 0 )
{
start_ptr += boundary_match_len;
- start_ptr += strspn( start_ptr, "-" );
+ start_ptr += strspn( start_ptr, "-\x22" ); // modified to allow facultative double quote in boundary="myboundary" like on IC-1500 cameras
content_boundary_len = sprintf( content_boundary, "--%s", start_ptr );
+ content_boundary_len = strcspn( content_boundary, "\x22" );
+ content_boundary[content_boundary_len]='\0';
Debug( 3, "Got content boundary '%s'", content_boundary );
}
else

Posted: Sun Apr 26, 2009 11:27 am
by cordel
I take from your sig that this is for version 1.24.1 :?:

Posted: Sun Apr 26, 2009 6:40 pm
by pbae
yes indeed. it's from the latest checkout.

Pascal

IC–1520

Posted: Sun Jul 12, 2009 7:41 pm
by johnnytolengo
How can i do the change in ZM 1.23 ?

I want to make work a Edimax IC–1520.


Help please! :)


Thanks.

Posted: Tue Jul 14, 2009 2:11 pm
by johnnytolengo
I got i work with this config:

firmware: v1.27

Code: Select all

source type: remote
remote hostname: admin:1234@ip.of.cam.era
remote host port: 80
remote host path: /snapshot.jpg
running really nice.

Why did you use "/snapshot.cgi " ?

What is the diference between them (/snapshot.cgi and /snapshot.jpg)?

Posted: Fri Sep 11, 2009 1:46 pm
by pbae
hi johnnytolengo,

/snapshot.cgi provide streamed content mjpeg (~20 fps)
/snapshot.jpg provide still snapshots (~5 fps).

However, to recognize the mjpeg stream, the patch proposed need to be applied and recompile.

Pascal

Posted: Fri Sep 11, 2009 2:19 pm
by pbae
in response to several PM on how to apply the patch:

copy and paste the content below in an editor and save it as patch.txt
--- /tmp/zm/src/zm_remote_camera_http.cpp 2009-04-26 10:12:26.000000000 +0200
+++ /usr/src/zm/src/zm_remote_camera_http.cpp 2009-04-26 10:18:25.000000000 +0200
@@ -283,7 +283,7 @@
}

if ( !content_type_expr )
- content_type_expr = new RegExpr( "Content-type: ?(.+?)(?:; ?boundary=(.+?))?\r?\n", PCRE_CASELESS );
+ content_type_expr = new RegExpr( "Content-type: ?(.+?)(?:; ?boundary=\x22?(.+?)\x22?)?\r?\n", PCRE_CASELESS );
if ( content_type_expr->Match( header, header_len ) >= 2 )
{
content_type = content_type_expr->MatchString( 1 );
@@ -712,8 +712,10 @@
if ( strncasecmp( start_ptr, boundary_match, boundary_match_len ) == 0 )
{
start_ptr += boundary_match_len;
- start_ptr += strspn( start_ptr, "-" );
+ start_ptr += strspn( start_ptr, "-\x22" ); // modified to allow facultative double quote in boundary="myboundary" like on IC-1500 cameras
content_boundary_len = sprintf( content_boundary, "--%s", start_ptr );
+ content_boundary_len = strcspn( content_boundary, "\x22" );
+ content_boundary[content_boundary_len]='\0';
Debug( 3, "Got content boundary '%s'", content_boundary );
}
else
then from the shell, execute the command:

Code: Select all

patch /usr/src/zm/src/zm_remote_camera_http.cpp patch.txt
of course, please adapt the path to met your installation.

once patch applied, recompile (make) and install the new build.


cordel, do you plan to include this patch in next release?

thanks

Pascal

Posted: Fri Sep 11, 2009 6:23 pm
by johnnytolengo
Ohhhhhhh thank you VERY MUCH!

It will be really usefull for me.

Tolengo

Posted: Tue Sep 22, 2009 8:29 am
by freechelmi
Hi .

I contacted the edimax supported and they just answered me with another URL :


http://ip-address/mjpg/video.mjpg for IC1500 at least.

Do you confirm ? What perfs can be done with this URL ?

Posted: Tue Sep 22, 2009 8:34 am
by freechelmi
BTW I just saw that Edimax published all the CGI commands and URL in July :


http://www.edimax.com/images/Image/CGI/ ... mmands.zip

That's a really good manufacturer then !

Posted: Tue Jan 19, 2010 10:43 pm
by roundhay
Does anyone know if this patch works with the IC-1510wg?

Posted: Wed Feb 24, 2010 12:13 pm
by spychodelics
hi, i just got a ic-1500wg, running fine with snapshot.jpg at 5 fps but i dont get the cgi part working, is this implemented yet?

if changing to cgi zoneminder leaves the "video field" blank.

Im using the last Zoneminder-svn @ archlinux. 1.24.2

thanks for help

Posted: Tue May 25, 2010 11:49 pm
by decibel83
pbae wrote:copy and paste the content below in an editor and save it as patch.txt
then from the shell, execute the command:

Code: Select all

patch /usr/src/zm/src/zm_remote_camera_http.cpp patch.txt
of course, please adapt the path to met your installation.
I pasted the code in patch.txt and ran the patch command, but I'm getting this error:

Code: Select all

venere:/usr/local/src/ZoneMinder-1.24.2# patch src/zm_remote_camera_http.cpp patch.txt
patching file src/zm_remote_camera_http.cpp
patch: **** malformed patch at line 4: }
Could you help me please?
Thank you very much!
Bye.