Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
Nächste ÜberarbeitungBeide Seiten der Revision
webcam:mjpeg [2008/10/27 21:54] geraldwebcam:mjpeg [2008/10/28 12:41] gerald
Zeile 8: Zeile 8:
 [[http://www.logilink.eu/cmsfiles/modules/i-sell2u/showproduct.htm?isu_zeigeartikel=WC0002|LogiLink]] [[http://www.logilink.eu/cmsfiles/modules/i-sell2u/showproduct.htm?isu_zeigeartikel=WC0002|LogiLink]]
  
-IP Address :  192.168.123.176+IP Address :  192.168.122.223
  
 Subnet Mask : 255.255.255.0 Subnet Mask : 255.255.255.0
Zeile 21: Zeile 21:
  
 HTTP Port : 80 HTTP Port : 80
 +
 +
 +===== Ziel: mjpeg auf dem Browser =====
 +
 +Problem: Keine Dokumentation. Webinterface soll das zwar können, aber JAvaScript zu schlecht.
 +
 +<del>Schaut gut aus, klappt aber nicht:
 +
 +mplayer http://admin:[password]@gerald.webhop.org:14322/IPCamPluginMJPEG.cab -vo gl</del>
 +
 +
 +Webinterface ruft folgendes JavaScript auf:
 +
 +http://gerald.webhop.org:14322/ipcam.js?v=200708241090
 +<code>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>');</code>
 +
 +Das Plugin kann man mit <code>
 +wget http://admin:[password]@gerald.webhop.org:14322/IPCamPluginMJPEG.cab
 +</code> 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: Quelle((http://spodzone.org.uk/packages/hawking-HNC230G.txt))
 +<code ruby>
 +#!/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")
 +
 +}
 +</code>
 +
 +You can get images from your camera with my PHP script and a web server in the following form: 
 + Quelle((http://webserver/Edimax_IC1500.php)) 
 +
 +<code php>
 +   <? 
 + 
 +     $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); 
 + ?></code> 
 +
 +
 +Uff! Finally, habs ichs rausgefunden:
 +<code>
 +// Bild:
 +http://gerald.webhop.org:14322/snapshot.jpg
 +// stream:
 +http://gerald.webhop.org:14322/snapshot.cgi
 +</code>
 +
 +
 
Nach oben
webcam/mjpeg.txt · Zuletzt geändert: 2024/02/29 13:36 von 127.0.0.1
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