Motion - Feature Request 2005x 05x 05x 150519

Feature Request: Grab just one image from webcam

Description

using a http://camera:server/?mode=single could return just one jpeg image from camera for grab images, with wget it could return last image from camera for crond for example.

-- RobertoSpadim - 05 May 2005

Follow up

I don't see why this feature is usefull , you already can get an image using a simple php/python/perl script that grabs an image from the jpeg stream. You an use the one of the related projects :

-- AngelCarpintero - 06 May 2005

Comments

if i use php i need a tcp port to web server...and many isp in brazil just support some ports wink so making grab just one image could help

and it's just some changes on webcam.c send the first image and disconnect wink

-- RobertoSpadim - 08 May 2005

No. Check out related project MjpegProxyGrab.

The Grab part is what you need.

It will deliver one frame grabbed from the webcam port of Motion and output it to standard out.

And by using this on your webserver the client get the picture as normal jpeg on port 80 from any of your cameras.

-- KennethLavrsen - 08 May 2005

but i have just port 80 open for connection 

this can check if mode=single:

add in webcam.c
    in function webcam_add_client
   char c[15];
   int ret;
   //?mode=single
   ret=0;
   read(new->socket,&c,5);
   if (strncasecmp(c,"GET /",5)==0){
       read(new->socket,&c,12);
       if (strncasecmp(c,"?mode=single",12)==0)
      ret=1;
   }

-- RobertoSpadim - 09 May 2005

if i use motion and web server i need two tcp ports.... did see the problem? i have just port 80 open for connections frown, sad smile

-- RobertoSpadim - 14 May 2005

You have Motion and Apache running on the same machine I assume?

The related project MjpegProxyGrab running as a nph- cgi script on an Apache server does exactly what you need. It serves a single image from any of your camera threads on port 80.

That is exactly what I wrote that little tool for. Only one program can bind to a server port. Two Motion threads cannot bind to port 80. The nph-mjgrab program is initiated by Apache which is bound to port 80. It starts the nph- cgi program which then grabs a single image from the mjpeg stream. This jpeg is sent by Apache directly to the client browser as a request from port 80.

The PHP solutions that people make are maybe more simple but since the image sent to the browser has to be an image tag in a HTML page this will invoke the PHP interpreter in Apache. I believe the C programs are the fastest way which demand the least resources. And it is very easy to compile and setup. It is very basic C with no strange libraries or anything.

Give it a try. Go to MjpegProxyGrab. Download the mjpeg-proxygrab-1.2.tar.gz and follow the instructions. I use both nph-mjprox and nph-mjgrab on my own web server serving also my mjpeg streams on port 80 and it works great.

-- KennethLavrsen - 14 May 2005

This is essentially a duplicate of the already accepted FeatureRequest2005x05x02x170207 so I am putting it in accepted but the implementation will most likely be as I suggested in the other request FeatureRequest2005x05x02x170207.

-- KennethLavrsen - 05 Jul 2005
Topic revision: r8 - 05 Jul 2005, KennethLavrsen
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.