1 (edited by josep 2009-01-16 11:33:49)

Topic: Dual Cams Widget

Hi There,

I created a new widget that displays two cams at the same time with a few unique features:

PIP Control:
1) You can display both cams using Picture In Picture (PIP) at the same time on the screen. This is nice for security applications.
2) You can move the small cam around by touching and holding the cam for 1 second and then dragging it to a new place on the screen.
3) You can toggle between cam1/cam2 being the main cam by tapping on the small cam
4) You can toggle PIP by tapping on the center of the main cam

Pan/Tilt Control:
1) If your camera has pan/tilt controls then you can add the url of the pan/tilt command and the widget will perform the move.
2) Commands work on the main cam like you would expect them to: tap on left of center and "left command url" will be called, etc.
3) You can hold your finger on the pan/tilt command area without having to tap to activate pan/tilt.
4) I know it currently works with Panasonic C-131a (that's the one I have smile )

If the camera needs authentication you will have to use one of the methods previously discussed on other posts for it to work ( php on a side server, wget, etc. ) I currently use lighty and the recently ported php for the chumby to accomplish authentication as well as pan/tilt control.

I hope the widget is useful/entertaining. I welcome any suggestions.

Thanks,
Jose

Re: Dual Cams Widget

Nice!   I was thinking about a 4 cam system ( as soon as there is a work around for sending login/pass to access the cam )

Re: Dual Cams Widget

Hi pshipley,

There IS actually a workaround. You can use the chumby's built in server as a proxy using the wget command. Let me know if you want me to elaborate more on it. There are a few on the subject. Search for webcam authentication.

I thought about making the widget so that the user configures how many cameras they want. This doesn't seem too bad to program, except for the fact that I am sure there will be a limit on how many cams the chumby will be able to handle.

Regards,
Jose

Re: Dual Cams Widget

Hey Jose,

Could you make the application more generic?

So that you could choose your camera brand, and then your widget would support that.

I have a Linksys WVC200, and apparently it doesn't work with your widget.

Best regards

Pelle

Re: Dual Cams Widget

Jose,

Did you get sound to work with this widget? I was looking at the Panasonic camera you have and it seems to do some magic using Active X for sound.

Thanks,

Howard

Re: Dual Cams Widget

troymclure wrote:

Hey Jose,

Could you make the application more generic?

So that you could choose your camera brand, and then your widget would support that.

I have a Linksys WVC200, and apparently it doesn't work with your widget.

Best regards

Pelle

Try the URL

http://THE.CAM.IP.ADDR/img/snapshot.cgi … ;quality=1

( try this in a browser window first, till you get the other prams right. )

Re: Dual Cams Widget

I have a couple of Panasonic cameras also.  BL C10 and BL30A.  I want to use your widget but I can't figure out the address to enter.  Do I need to put in the local network address like http://192.168.15.252:50001?  or the viewnetcam.com web page?

8 (edited by josep 2009-01-29 14:47:18)

Re: Dual Cams Widget

Hey Jose,

Could you make the application more generic?

So that you could choose your camera brand, and then your widget would support that.

I have a Linksys WVC200, and apparently it doesn't work with your widget.

Best regards

Pelle

The problem is that I don't really know the command for most cams. Also, as far as I know, there are no "generic" ways of snapshotting cameras that need authentication. You can't just enter http://usr:passwd@camaddress/snapshotCommand. It's a lot easier to get it to work more "generically" if the camera is "open".

The best solution I found is to use the chumby server and "wget" to do the authentication for you. I also got it working with PHP and a side home server, but this is not as satisfying as getting to work with the chymby server. I also found out that some cams don't have a "snapshot" command at all.

I can see how having a generic list of cameras instead of asking the user to enter the one for their specific camera is beneficial, though. Right now I know that it works for my panasonic and for my Y-Cam. By the way, I had to contact y-cam directly and ask them for a firmware update before the cam could snapshot pictures.


I'll look into the WVC200. I'll keep you posted.

Regards,
Jose

Re: Dual Cams Widget

Plank wrote:

I have a couple of Panasonic cameras also.  BL C10 and BL30A.  I want to use your widget but I can't figure out the address to enter.  Do I need to put in the local network address like http://192.168.15.252:50001?  or the viewnetcam.com web page?

For open Panasonic Cams.

image: http://address_of_cam/SnapshotJPEG?Resoultion=320x240&Quality=Standard

Actually, the widget will be able to display the image even if the resolution is not the native Chumby resolution (320x240), but choosing the resolution right at the camera will give you the best image quality. 

Controls (requires crossdomain file and cgi script):

left: http://address_of_cam/nphControlCamera?Direction=PanLeft
right: http://address_of_cam/nphControlCamera?Direction=PanRight
up: http://address_of_cam/nphControlCamera?Direction=TitlUp
down: http://address_of_cam/nphControlCamera?Direction=TitlUp

If your chumby is in the same network as your camera, then you can use the "ip" of the camera (e.g. 192.168.15:252:50001). If not, you will have to use the viewnetcam address.

Let me know if you want me to elaborate more on how to get the controls to work (similar to having to write a cgi script if your camera has authentication). Obviously, you will need a little "hacker" know-how(pretty trivial, and fairly well documented on this forum) to get it to work.

Since I can't possibly research all the cameras out there in a timely manner, it would be great if other users could post their methods for accessing their cams (and controls).

Regards,
Jose

Re: Dual Cams Widget

Jose,

Did you get sound to work with this widget? I was looking at the Panasonic camera you have and it seems to do some magic using Active X for sound.

Thanks,

Howard

Hi Howard,

I worked on that for quite a while, but hit ta few major road blocks : 1) Flash Lite does not support sound streaming, and 2) g726 Audio is not supported on the Chumby. Duane looked at what it would take to get the audio format supported, but found that the format was poorly documented and decided that the chance of getting it to work work was slim.

I think there is a chance to get it working if we can add the support in BT. Even if bt supported the format, I would still have to figure out how to have something on the side "streaming" the audio. I wrote something in PHP to get "snipets" of audio (on g726), but not sophisticated enough for streaming. Here is the code:

<?php

$response = http_get("http://usr:pass@192.168.1.3/nphAudio?Mode=Mixed", array("timeout"=>20));

$parsed_msg = http_parse_message($response);

//print_r($parsed_msg);

$body_of_msg = $parsed_msg->body;

//echo "$body_of_msg";

$data = "";
// parse the body to remove all the information in between the boundaries
$chunks = explode("\r\n",$body_of_msg);

$i = 0;
foreach($chunks as $body_element) {
   //echo "$i: $body_element\n";
   $i++; 
   if( $i == 7 ) { 
      $i = 0;
      $data = $data . $body_element;
   }
   //if(strlen($body_element) > 2) { 
     // if( (strrpos($body_element,"boundary"   ) == false )&& 
       //   (strrpos($body_element,"Control"    ) == false )&& 
         // (strrpos($body_element,"Permission" ) == false )&&
          //(strrpos($body_element,"Content"    ) == false )    ) { 
     //    $data_to_store = $data_to_store . $body_element; 
         //echo "DATA: $data\n";
      //}
  // }
   //$data = '$data' . '$body_element';
}

//file_put_contents("test_audio.g721",$data);
file_put_contents("test_audio.g726",$data);

?>

I found a player on the web that can play g726 and verified that indeed the code does extract audio.

Here something else I wrote to get the video with audio. You can then create an mjpeg file. The file has all the info needed to play it like a movie:

<?php


$response = http_get("http://usr:pswd@192.168.1.10/nphVideo?Mode=0?Resolution=320x240?Quality=Standard", array("timeout"=>1));

$parsed_msg = http_parse_message($response);

//print_r($parsed_msg);

$body_of_msg = $parsed_msg->body;

// echo "BODY:$body_of_msg";

$audio = "";
$video = "";

// parse the body to remove all the information in between the boundaries

$v = 0; // audio is first

$new_string = $body_of_msg;
$pos = strpos($new_string,"myboundary"); // start of new data
//echo "POS: $pos\n";
while($pos) { 

   //echo "HERE 1\n";

   $new_string = substr($new_string, $pos+10);      // forward to the data
   //echo "NEW STRING: " .  substr($new_string, 0, 100);
   $pos2 = strpos($new_string, "Content-length:"); // length of data
   //echo "POS2: $pos2\n";
   if($pos2) {

      //echo "HERE 2\n";

      $new_string = substr($new_string, $pos2+16);   // go to start of bytes

      // get number of bytes and extract the data
      $i = 1; 
      $bytes = $new_string{0}; 
      while($new_string{$i} != "\r" ) {
         //echo "HERE 3\n"; 
         $bytes = $bytes . $new_string{$i};
         $i++;
      } 
      //echo "BYTES: $bytes\n";
      //echo "HERE 4\n";
      $i = $i + 4; // skip \r\n\r\n
      $data = substr($new_string, $i, $bytes);      // get the data

      //$new_string = substr($new_string, $i+$bytes); // fast forward the data; do we have to?           
   } else { 
      $bytes = 0;
   }
   if( $v == 1 ) { // video; set up for audio
      $v = 0;
      if( $bytes > 0 ) {   // 0 data sometimes  
         $video = $video . $data;
      }
   } else { // audio; set up for video
      $v = 1;
      if( $bytes > 0 ) {   // 0 data sometimes
         $audio = $audio . $data;
      }
   }
   $pos = strpos($new_string,"myboundary"); // start of new data
   //echo "POS: $pos\n";
}

$data = $audio . $video;
file_put_contents("test_video.mjpg",$data);


?>

No streamng, though.

I think what needs to happen for the cam audio to work is this:    1) Flash Lite streaming must be supported (I hear this might happen soon), and 2) a stream must be created for the cam (maybe something that creates a g726 stream from the cam and converts it to a mp3 stream for Flash ?, or somehow support g726 streams directly(with bt?))

I am open to suggestions. Maybe my php code turns on a light bulb.

Regards,
Jose

Re: Dual Cams Widget

josep, you are the greatest.  Your instructions worked like a charm (I didn't try or use the pan & tilt).  I would never figured it out on my own.  My chumby just got even more useful.   THANK YOU

Re: Dual Cams Widget

I searched around on the web and found out how to extract images for two more cams:

Axis Products:
http://<IPAddress>:<PortNumber>/axis-cgi/jpg/image.cgi

Linksys Products:
http://<IPAddress>:<PortNumber>/img/snapshot.cgi

As before, as far as I know, authentication needs to be done with a side server.

Regards,
Jose

Re: Dual Cams Widget

a good resource for camera snapshot  URLs is

http://www.lavrsen.dk/twiki/bin/view/Mo … ingDevices

Re: Dual Cams Widget

How would I get my Chumby to look at a Sony PTZ video cameraor an Axis 241Q video server (4 views) on my network ?  I've tried inputting the ip address of the cameras and get a black screen.

Re: Dual Cams Widget

Just entering the IP of the Axis server isn't enough, since that's probably HTML.  What you want is a URL to an actual single JPEG (*not* Motion JPEG) image.

I've taken a quick look at the online manual - it seems this is possible for this device - the URL would look something like:

http://ip.of.the.server/axis-cgi/jpg/image.cgi?resolution=CIF

Re: Dual Cams Widget

If I have put in the pan commands, and tested they work in a browser, I do not see any pan controls on the screen?

Re: Dual Cams Widget

josep wrote:

Hi There,

I created a new widget that displays two cams at the same time with a few unique features:

PIP Control:
1) You can display both cams using Picture In Picture (PIP) at the same time on the screen. This is nice for security applications.
2) You can move the small cam around by touching and holding the cam for 1 second and then dragging it to a new place on the screen.
3) You can toggle between cam1/cam2 being the main cam by tapping on the small cam
4) You can toggle PIP by tapping on the center of the main cam

Pan/Tilt Control:
1) If your camera has pan/tilt controls then you can add the url of the pan/tilt command and the widget will perform the move.
2) Commands work on the main cam like you would expect them to: tap on left of center and "left command url" will be called, etc.
3) You can hold your finger on the pan/tilt command area without having to tap to activate pan/tilt.
4) I know it currently works with Panasonic C-131a (that's the one I have smile )

If the camera needs authentication you will have to use one of the methods previously discussed on other posts for it to work ( php on a side server, wget, etc. ) I currently use lighty and the recently ported php for the chumby to accomplish authentication as well as pan/tilt control.

I hope the widget is useful/entertaining. I welcome any suggestions.

Thanks,
Jose

Can someone reference me to how to get my chumby to signon to my  Panasonic camera?  Not sure what to search for.  Thanks.

Re: Dual Cams Widget

hi all

i have problems to config DUAL CAM WIDGET with my ROBOCAM III @ 192.168.1.10 ( port 554 )

if i config CAM 1 with "192.168.1.10" the widget cant find the cam..

what exactly should i enter i the cam-Fields ? i know the ip-adress from the cam . but not what is the name of the stream-file @ 192.168.1.10

please help

thanks

Re: Dual Cams Widget

I wrote a Windows Application to view my IP cameras. The cameras use the URLs below. I tried each of these with the Dual Cams application but none of them worked. These work in my web browsers but not on the Dual Cams application.

http://<IP of Camera>:<Port Number>/snapshot.cgi?user=<username>&pwd=<password>

http://<IP of Camera>:<Port Number>/videostream.cgi?user=<username>&pwd=<password>&resolution=8

http://<IP of Camera>:<Port Number>/videostream.asf?user=<username>&pwd=<password>&resolution=8

Re: Dual Cams Widget

Hello.

2 x TrendNet IP-110W ip cameras

Used helpful URL to determine the URL for this camera's JPEG stream:
http://user:password@xx.xx.xx.xx/cgi/jpg/image.cgi

Preview on the "add app" page appeared perfect.
Black screen on the C1.

-I suspect the resolution is at issue here, but just a guess.

Help from the audience appreciated.

21

Re: Dual Cams Widget

@Kurtois -- not much help, but some hope:  I've got two TV-IP110W cameras configured into this and it works fine on the real Chumby One.  One camera is local inside my router (so I use its 192.168.xxx.xxx IP) and one is remote (so I use its dynamic DNS address camname.dyndns.org).

In both cases the cameras have user/password authentication set up, and I am using the same URL syntax as what you've shown. EXCEPT I have both cameras set up to use a different port than the default 80 (just to discourage random scraping), so the syntax is

http://user:password@192.168.xxx.xxx:portnum/cgi/jpg/image.cgi   (inside-the-router camera)
http://user:password@camname.dyndns.org:portnum/cgi/jpg/image.cgi  (remote camera)

Presumably you haven't changed the port number in your cameras, since you aren't specifying it in your URL, so it would default to 80, same as the camera's default.  But if your cameras DO use a different port number, there's your problem!

Also: if  your camera(s) are inside your local network, same as the Chumby: Some (many?) modem/routers do not allow a loopback through their NAT port mapper, which means that you'd not use an "outside" DNS-based named URL for "inside the router" cameras, but rather their local IP address.   Sorry if this is just recapping stuff you already have covered.

Re: Dual Cams Widget

I used to use Dual Cams Widget daily when Chumby used to be online. But  I can't find this widget any more since Chumby is offline. If any one has this widget I would greatly appreciate a copy so I can run it from a USB Stick.