Small C program that connected to an MJPEG stream and saves the raw data (first 100k) in a file.
And a Perl nph cgi program which can play it back via an Apache server
The idea of the program is to get raw data from a Network camera for analysis. If a camera does not work with Motion you can use this tool to make a file containing the raw data stream returned from the camera so the developers can better find out what it takes to make Motion work with the camera.
It does not yet work with authentication (user name and password).
There is one source file only.
First you must edit 4 lines of code.
The 4 #defines must be set before you build the program.
You need to set IP address of the motion server and the portnumber for the camera. IP address 127.0.0.1 means local host (same machine).
#define IPADDR "127.0.0.1" /* IP address of motion server, 127.0.0.1 = localhost */
#define PORTNUMBER 80 /* Port number of camera */
#define URLPATH "/cam1/jpeg.jpg" /* path following ipadr and portno. */
#define USERPASS "" /* "username:password" for Basic Authorization */
Program mjpegsnif now can be built with this command:
gcc -Wall -O3 -o mjpegsnif mjpegsnif.c
The nph-rawparse.pl program should be copied typically to your cgi-bin directory of your apache server. Make sure to change file owner to the Apache server user - typically 'nobody' and make it executable.
If you have the current working directory to be where you just built the binary simply run it like this
Usage: ./mjpegsnif > rawfile
If you copy this rawfile to the cgi-bin directory you can now let Motion connect to the localhost by using the option value:
You can now play with the rawfile and see what Motion likes and does not like.
If you report problems with the new Motion netcam feature, open a bug report and attach the rawfile to the topic.
Uploading mjpeg files.
Do not upload your files here. This topic is for people to find and download the tool itself and it becomes quite difficult to find out what is program and what is camera dumps.
Go to the topic NetcamMjpegStreamDumps
and post your mjpeg dumps there.
If you want support for a new camera that Motion does not support, submit a request on FeatureRequests
All jpeg images start with ffd8 and end with ffd9, and they never include these in the stream between as per doc.
Boundary strings might, but I seriously doubt it. So why not just search for these? Sometimes content-length is specified, then we could jump from ffd8 to the next header instead of searching for ffd9. All network cameras sending jpegs in stream would work.
- 08 Dec 2010