Page 1 of 1

How to pull a jpg from a website every xx seconds using ZM?

Posted: Sat Feb 12, 2011 1:23 am
by Eklectick
Hi Community:

I am trying to configure ZM 1.24.2 installed through ZMLarch live cd to extract a jpg some camera is uploading via FTP to a website.

If I use:

Code: Select all

http://www. any website.com/mobilecam/video.jpg
I CAN see an image on any browser.

This is what I have tried:

Code: Select all

Source Type: Remote

Source Tab:
Remote Protocol: HTTP
Remote Method: Regexp (tried Simple too)
Remote Host Name: www. any website.com
Remote Host Port: 80
Remote Host Path: /mobilecam/video.jpg
Remote Image Colors: 24	
Capture Width (pixels): 640	
Capture Height (pixels): 480	
Preserve Aspect Ratio:	
Orientation: Normal

--- THIS SETTING IS NO GO SHOWS BLACK IMAGE BOX---

Source Type: File

Source Path: www. any website.com/mobilecam/video.jpg
Source Colours: 24
Capture Width (pixels): 640	
Capture Height (pixels): 480	
Preserve Aspect Ratio	
Orientation: Normal

--- THIS SETTING IS NO GO SHOWS BLACK IMAGE BOX---

Logs:
WAR [Shared data not initialised by capture daemon, some query functions may not be available or produce invalid results]
WAR [Unable to store frame as shared memory invalid]

The image is correctly configured to be 640x480.

What would the correct configuration to just "pull" a jpg from a website say every xx seconds be?

Regards!

Posted: Sat Feb 12, 2011 6:23 pm
by clipo
I hope you're not trying to rip some one else's camera images with out there permission, taking images at regular intervals from some ones system is impolite and a drain on resources.

If you do own the system or have permission then read on.

Have a read through this post

http://www.zoneminder.com/forums/viewto ... highlight=

pay attention to post No6, from my self, this is a little guide how to make ZM extract images from another ZM system acting as the source for a local one, it is almost doing what you want by using a remote jpg as a source.

Posted: Sat Feb 12, 2011 6:25 pm
by clipo
Alternatively just use wget and a simple cron job script to rip a jpg to the local system then use that as your ZM source.

Posted: Sun Feb 13, 2011 4:54 am
by Eklectick
Hi Clipo

Thanks for your help. I have a 3G camera working via cellular line but IP is masked (no route back to camera) so camera uploads FTP image to a server and from there is where I am trying to pull this jpg.

I am not linux saavy, do know I could setup FTP server on this box, used ZMLarch Live cd to install but dont know how to setup FTP or if it even is possible.

wget sounds good I have done that through command line but are pretty far from scripting cron jobs :-S

So is there no way ZM could just pull this directly from an URL?

Regards!

Posted: Sun Feb 13, 2011 6:53 am
by Flash_
Yes.

Under source:

hostname: www. any website.com

path: /mobilecam/video.jpg

Amend colour, x and y to fit.

Then to get the timing, under General tab, amend the "maximum fps".

ZM will work with values below 1 in this. So for one frame every 2 seconds, you would set this to 0.5

0.25 for one frame every four seconds, 0.1 for ten seconds and so on.

Set the max frames to the same value.

The only downside with this and your ftp push is occasionally you may fetch a frame while it is still being written and you'll get a torn ,incomplete or corrupted image. If the jpg is being created on demand by a cgi script or something (as ip cameras do) then of course it will provide a full image and not torn.

It is better to get the image directly, and you would be able to do that by other means, (vpn, dyndns and holes punched in firewalls) but there are always more than one way to do things.

Posted: Sun Feb 13, 2011 8:11 am
by Petey
Eklectick,

I suspect you are having the same problem that I did.

ZoneMinder does not implement the full HTTP 1.1 protocol. The webserver is likely sending the data in "chunked" mode, which ZoneMinder does not understand.

The Fix: Go to Options -> Network and change HTTP_VERSION to 1.0.

Posted: Sun Feb 13, 2011 6:16 pm
by Eklectick
Hi Flash and Petey:

Flash
Have done under source instructions using HTTP protocol and both Simple and Regexp full hotname wwwdotetcdotcom and correct path with 24bitcolor and 640x480 image but no go.

Petey
Did the HTTP protocol change, restarted ZM but still a black screen :-S

I know this should work being zm as flexible as it is I just cant find the tweak to get this going, any other sugestions?

Appreciated in advance

Regards!

Posted: Sun Feb 13, 2011 6:41 pm
by Petey
Look in /var/log/messages and see if there's anything revealing in there about your problem.

Try enabling debug mode. Options -> Debug;
  • Check the EXTRA_DEBUG box
    EXTRA_DEBUG_TARGET = I'd try "_zmc", probably -- zmc is the capture process
    EXTRA_DEBUG_LEVEL = 5, maybe 6
Then restart ZoneMinder. Then you'll have a whole bunch of debug information in /tmp/zm_debug.etc,etc

Hopefully that will give you some more information on what step of the process specifically is failing.

Posted: Mon Feb 14, 2011 2:17 am
by Eklectick
Hi

This is what I get when I try to see a capture image by clicking on monitor:

Code: Select all

INF [Authenticated user 'root']
WAR [Shared data not initialised by capture daemon, some query functions may not be available or produce invalid results]
WAR [Unable to store frame as shared memory invalid]
Using Source:

Code: Select all

Remote Protocol: HTTP
Remote Method: Simple and tried Regexp
Remote Host Name: www.some web site.com
Remote Host Port: 80
Remote Host Path: /mobilecam/video.jpg
Remote Image: 24 bit color
Capture Width: (pixels)640
Capture Height: (pixels)480
Preserve Aspect: Ratio
Orientation Normal:
Regards!

Posted: Mon Feb 14, 2011 6:25 am
by Flash_
Have you followed the steps in the FAQ about allocating shared memory?

Your error message isn't identifying that in the normal way, but any colour 640x480 image will require this to be changed in every distro I've used, so change that before you go any further.

Posted: Mon Feb 14, 2011 6:21 pm
by Eklectick
Hi Flash

Thanks for your reply, did read the memory FAQ but found it way out of my league to be tinkering with that, although I really think my problem is somewhat other you see, I used source as File, uploaded the jpg image into a directory inside ZM and it read it without any trouble or errors, so I guess this is more of something I am not quite configuring on paths in order to pull it from a simplre http page :-S

Regards!

Posted: Tue Feb 15, 2011 12:27 am
by bb99
I guarantee you that Flash has given you the 1st step in troubleshooting this. Just tested on a 704*480 streamed jpeg and had to edit /etc/sysctl.conf to get it to work; otherwise what you are doing is correct.