Motion - Mjpeg Sniffer

MJPEG Sniffer

Introduction

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

Detailed Description

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).

Attached Files

There is one source file only.

http://lavrsen.dk/foswiki/pub/Motion/MjpegSniffer/mjpegsnif.tgz

Installation

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.

Users Guide

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:

netcam_url http://localhost/cgi-bin/nph-rawparse.pl

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.

Comments and Bug Reports


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.

-- LaszloVarga - 08 Dec 2010

RelatedProjectsForm edit

ProjectSummary MjpegSniffer connects to an mjpeg stream and saves first 100k of raw data to a file
ProjectStatus Stable
ReleaseVersion
ProjectSubmitter KennethLavrsen
Topic attachments
I Attachment Action Size Date Who Comment
mjpegsnif.tgztgz mjpegsnif.tgz manage 23 K 14 Feb 2005 - 08:49 KennethLavrsen Version 1.1 with authentication fix
Topic revision: r7 - 08 Dec 2010, LaszloVarga
Copyright © 1999-2017 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.