Thursday, 12 July 2007

Windows-only IP camera on linux

I got a nice panning VGA camera for £69.00, but it’s one of those cameras from hell that only supports internet explorer on windows and crashes windows a lot.

As far as I can tell generically it is an SQ IP Cam or a GP-280 IP Camera.

I want to use it on linux, so out comes ethereal to do some packet sniffing and here is what I get:

I can get a video stream (special header and concatenated JPEG’s) with this URL:

Possibly the RootCookies bit is important, perhaps related to a login that occurred earlier.

I can move the camera wth:

For horizontal and vertical centre

Full centre

To stop

The special header on the video stream is a 40 byte header. I’m expecting certain values so they were easy to find:

Stream Header
Offset Format Data
0×16-0×17 16 bit integer LSB size of jpeg in bytes, or in other words, the number of bytes to read after this header before the start of the next header
0×1a-0×1b 16 bit integer LSB jpeg width in pixels
0×1c-0×1d 16 bit integer LSB jpeg height in pixels
0×28- Start of JPEG header

So stripping off the first 40 byte with
dd if=stream of=1.jpeg bs=1 skip=40

leaves me a jpeg (with loads more jpegs on the end, ech prefixed by the same 28 byte header).

So I can control the camera and rip video from it, now to make it like zoneminder.


I can watch a video stream with VLC using:

wget -O /dev/stdout |dd  skip=40 bs=1 | vlc -

I modified axmjpeg so it can split images from my camera too.

Update: 20 Sept 2007
This patch has been reworked applied to the standard axmjpeg project. (a while ago!)

This script can be used to control the camera from zoneminder:

#! /bin/bash
presets="nothing motor_control_auto_h motor_control_auto_v motor_control_stop motor_control_center"

while test -n "$1"
  case "$1" in
    --address=*) address="${1##--address=}";;
    --address)   address="$2"; shift;;
    --command=*) command="${1##--command=}";;
    --command)   command="$2"; shift;;
    --preset=*)  preset="${1##--command=}";;
    --preset)    preset="$2"; shift;;


case "$command" in
  # home goto
  preset_home) url_command="motor_control_center";;
  preset_goto) set $presets; shift "$preset"; url_command="$1";;
  # right left down up
  move_rel_*) url_command="motor_control_${command##move_rel_}" ;;

wget -O /dev/null "$url" 2>/dev/null

UPDATE snapshot

I found a URL that can be used for a single snapshot (based on this

Also related source code here:

UPDATE streaming

I can play the stream like this:

ffplay -f mjpeg -probesize 40 -i ''

tip from

but it seems more reliable to use axmjpeg to remove the extra data and output just a concatenation of jpegs:

axmjpeg -N -o /dev/stdout  '' | ffplay -f mjpeg /dev/stdin


  1. hello
    i have the same IP cam “gp 280″ and i need use this with firefox or VLC but with windows (for the moment)
    Wath must i do for use VLC for video??

  2. LiamK,
    Yes, the url should be RootCookies not RookCookies.
    Yes, you should replace USERNAMe and PASSWORD with your own username and password.

  3. Thanks,
    Tried to get a stream with my username and password but to no avail, any other suggestions. I would to get this working. any tips appreciated.
    Liam K

  4. I think it is RookCookie and not RootCookie, try that!

  5. Hi Liam,
    it is definitely RootCookies00000 - this is the name of the Cookie that’s created when you log in with your webcam administrator account. Alternatively, you could try UserCookies00000, which is the guest account equivalent.
    Also, the Acc=USERNAME and Pwd=PASSWORD must always be your administrator account name and password, even when using UserCookies00000 (no idea why).

  6. You are right about the lack of green, it’s pretty bad.
    I haven’t spent much time on this camera since I got the software working on linux, it does most of what I want.

  7. I also send you a mail because I thought the comments were disabled.
    I pressed F5 on Oprea Browser and saw nothing… mhm so finally the post is done….
    Hopefully you have any good ideas!

  8. Thanks Wilhelm - I wish I had known about that before! - But if I had axmjpeg would never have been amended…
    Now it can work in zoneminder as a proper networked camera.
    (I’ve just finished a perl network controller module for the new zoneminder which I need to publish)