Dies ist eine alte Version des Dokuments!


MJPEG Webcam

Chinesische Billigwebcam mit WLAN Firmware v1.28 (Sep 14 2007 10:09:45)

Manual (engl.)

LogiLink

IP Address : 192.168.122.223

Subnet Mask : 255.255.255.0

Gateway : 192.168.123.1

DNS Server : 192.168.123.1

MAC Address : 00:1F:1F:17:F9:3E

Video Port : 4321

HTTP Port : 80

Ziel: mjpeg auf dem Browser

Problem: Keine Dokumentation. Webinterface soll das zwar können, aber JAvaScript zu schlecht.

Schaut gut aus, klappt aber nicht: mplayer http://admin:[password]@gerald.webhop.org:14322/IPCamPluginMJPEG.cab -vo gl

Webinterface ruft folgendes JavaScript auf:

http://gerald.webhop.org:14322/ipcam.js?v=200708241090

document.write('<OBJECT ID="IPCam_Plugin" CLASSID=clsid:b015b944-7316-49ae-ac84-acca9379ea32 ALIGN="CENTER" WIDTH="'+ ipcam_width +'" HEIGHT="'+ ipcam_height +'" Codebase="/IPCamPluginMJPEG.cab#version=1,0,9,2">');
document.write('<PARAM name="IP" value="'+ window.location.hostname +'">');
document.write('<PARAM name="Port" value="'+ port +'">');
document.write('<PARAM name="Login" value="'+ login +'">');
document.write('<PARAM name="Password" value="'+ password +'">');
document.write('<PARAM name="Code" value="'+ code +'">');
document.write('<PARAM name="Debug" value="0">');
document.write('</OBJECT>');

Das Plugin kann man mit

wget http://admin:[password]@gerald.webhop.org:14322/IPCamPluginMJPEG.cab

runterladen

Das Plugin ist von der Firma 'Edimax' und ist anscheinend für den IE geschrieben. Dort funktioniert es aber auch nicht richtig, der IE beschwert sich über Fehler auf den Seiten.

Ruby-Skript, um Bilder zu catchen: Quelle1)

#!/usr/bin/env ruby
 
# Script to extract images from the Hawking HNC230G
# 
# Copyright (C) Tim Haynes 
# HNC230G{at}stirfried.vegetable.org.uk    http://pig.sty.nu/
#
# Redistributable under the terms of the GNU Public License: see
# <http://www.gnu.org/copyleft/gpl.html>
#
# Requires ruby, imagemagick
#
 
nopics=ARGV[1] || "1"
nopics=nopics.to_i
 
require 'socket'
require 'RMagick'
 
xsize,ysize=640,480
 
puts "Connecting"
 
s=TCPSocket.new('buffalo', 4321)
 
nopics.times { |n|
 
  puts "Requesting data"
  s.puts("0110")
 
  len=s.read(2).reverse.unpack("v")[0]
  2.times {s.getc }
 
  puts "Len: #{len}"
  jpeg=s.read(len)
 
  puts "Getting image"
 
  img=Magick::Image.from_blob(jpeg)[0];
 
  puts "Saving image"
  img.write("foo-#{n}.jpg")
 
}

You can get images from your camera with my PHP script and a web server in the following form: Quelle2)

   <? 
 
     $login = "admin"; 
     $pass = "xxxxxxx"; 
     $ip = "aa.bb.cc.dd"; 
     $port = "4321"; 
 
     // 120 byte 
     // 3x 0x00, 
     // 1x 0x01, 
     // user name 
     // 1x 0x00, 
     // password, 
     // Nx 0x00, 
     $logincmd = pack( 
        "x3H*a*xa*x" . 
           (120 - 3 - 1 - strlen($login) - 1 - strlen($pass)), 
        "01", $login, $pass); 
     // 120 byte 
     // 3x 0x00, 
     // 1x 0x0e, 
     // Nx 0x00, 
     $framecmd = pack("x3H2x116", "0e"); 
 
     $login_ok_reply = "0c"; 
 
     function error($msg) 
     { 
    global $sock; 
 
    if ($sock) { 
        fclose($sock); 
    } 
    die($msg); 
     } 
 
     function request($sock, $cmd, $len) 
     { 
    $ret = fwrite($sock, $cmd, $len); 
    if (!$ret) { 
        error("request()/fwrite()==FALSE"); 
    } 
    if ($ret != $len) { 
        error("request()/fwrite(): written: {$len}/{$ret}"); 
    } 
    fflush($sock); 
     } 
 
 /* 
     function dump($data, $file) 
     { 
    $f = fopen($file, "wb"); 
    if (!$f) { 
        error("dump()/fopen()"); 
    } 
    $ret = fwrite($f, $data); 
    if (!$ret) { 
        error("dump()/fwrite()"); 
    } 
    fclose($f); 
     } 
 */ 
 
     $sock = fsockopen("tcp://$ip", $port); 
     if (!$sock) { 
    error("fsockopen(tcp://$ip:$port)"); 
     } 
     // 350ms 
     stream_set_timeout($sock, 0, 350000); 
 
     request($sock, $logincmd, 120); 
     //echo("login request sent\n"); 
 
     $ret = stream_get_contents($sock, 120); 
     //echo("login reply received\n"); 
     if (strlen($ret) != 120) { 
    error("Error in reply for login. size:120/" . strlen($ret)); 
     } 
     //dump($ret, "0.dump"); 
     $reply = unpack("H*", $ret[3]); 
     if ($reply[1] != $login_ok_reply) { 
    error("Login incorrect!"); 
     } 
     //echo("OK\n"); 
 
     request($sock, $framecmd, 120); 
     //echo("get frame request sent\n"); 
 
     // 6 fix byte 
     $ret = fread($sock, 6); 
     if (!$ret) { 
    error("Frame signature fread()==FALSE"); 
     } 
     //dump($ret, "1.dump"); 
     $sig = unpack("H*", $ret); 
     if ($sig[1] != "000700060000") { 
    error("Frame signature incorrect"); 
     } 
     //echo("frame signature ok\n"); 
 
     // 2 byte: jpeg size. 
     $ret = fread($sock, 2); 
     if (!$ret) { 
    error("Frame size fread()==FALSE"); 
     } 
     //dump($ret, "2.dump"); 
     $unpacked = unpack("H*", $ret); 
     sscanf($unpacked[1], "%04x", $frame_size); 
     //echo("frame_size = $frame_size\n"); 
 
     // 20 byte ???. 
     $ret = fread($sock, 20); 
     if (!$ret) { 
    error("Skip before frame fread()==FALSE"); 
     } 
 
     // JPEG: $frame_size byte. 
     $ret = stream_get_contents($sock, $frame_size); 
     if (!$ret) { 
    error("Frame data stream_get_contents()==FALSE"); 
     } 
     if (strlen($ret) != $frame_size) { 
    error("Frame data stream_get_contents() size: " . 
       "{$frame_size}/" . strlen($ret)); 
     } 
 
     header("Content-Type: image/jpeg"); 
     header("Content-Length: $frame_size"); 
     header("Content-Disposition: inline; filename=current.jpg"); 
     echo($ret); 
 
     fclose($sock); 
 ?>

Uff! Finally, habs ichs rausgefunden:

// Bild:
http://gerald.webhop.org:14322/snapshot.jpg
// stream:
http://gerald.webhop.org:14322/snapshot.cgi

Vom Hersteller EdiMax gibt es auch die Software als OpenSource 3)

Mit einer URL alle Parameter verstellen: http://admin:1234@192.168.2.3/form/camera?resolution=0&quality=3&framerate=25&frequency=0&autoexposure=ON&b_value=35&c_value=50&s_value=50&h_value=50&w_value=10&enet_source=camera_left.asp

 
Nach oben
webcam/mjpeg.1225198451.txt.gz · Zuletzt geändert: 2024/02/29 13:35 (Externe Bearbeitung)
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0
DFmW2CEce3htPL1uNQuHUVu4Tk6WXigFQp   Dogecoin Donations Accepted Here    DFmW2CEce3htPL1uNQuHUVu4Tk6WXigFQp  DFmW2CEce3htPL1uNQuHUVu4Tk6WXigFQp