Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
webcam:mjpeg [2008/10/28 12:41] – gerald | webcam:mjpeg [2024/02/29 13:36] (aktuell) – Externe Bearbeitung 127.0.0.1 | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | MJPEG Webcam | + | ====== |
- | + | ||
- | Chinesische Billigwebcam mit WLAN | + | |
- | Firmware v1.28 (Sep 14 2007 10:09:45) | + | |
- | + | ||
- | {{: | + | |
- | + | ||
- | [[http:// | + | |
- | + | ||
- | 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: | + | |
- | + | ||
- | Video Port : 4321 | + | |
- | + | ||
- | HTTP Port : 80 | + | |
- | + | ||
- | + | ||
- | ===== Ziel: mjpeg auf dem Browser ===== | + | |
- | + | ||
- | Problem: Keine Dokumentation. Webinterface soll das zwar können, aber JAvaScript zu schlecht. | + | |
- | + | ||
- | < | + | |
- | + | ||
- | mplayer http:// | + | |
- | + | ||
- | + | ||
- | Webinterface ruft folgendes JavaScript auf: | + | |
- | + | ||
- | http:// | + | |
- | < | + | |
- | document.write('< | + | |
- | document.write('< | + | |
- | document.write('< | + | |
- | document.write('< | + | |
- | document.write('< | + | |
- | document.write('< | + | |
- | document.write('</ | + | |
- | + | ||
- | Das Plugin kann man mit < | + | |
- | wget http:// | + | |
- | </ | + | |
- | + | ||
- | Das Plugin ist von der Firma ' | + | |
- | + | ||
- | Ruby-Skript, | + | |
- | <code ruby> | + | |
- | # | + | |
- | + | ||
- | # Script to extract images from the Hawking HNC230G | + | |
- | # | + | |
- | # Copyright (C) Tim Haynes | + | |
- | # HNC230G{at}stirfried.vegetable.org.uk | + | |
- | # | + | |
- | # Redistributable under the terms of the GNU Public License: see | + | |
- | # < | + | |
- | # | + | |
- | # Requires ruby, imagemagick | + | |
- | # | + | |
- | + | ||
- | nopics=ARGV[1] || " | + | |
- | nopics=nopics.to_i | + | |
- | + | ||
- | require ' | + | |
- | require ' | + | |
- | + | ||
- | xsize, | + | |
- | + | ||
- | puts " | + | |
- | + | ||
- | s=TCPSocket.new(' | + | |
- | + | ||
- | nopics.times { |n| | + | |
- | + | ||
- | puts " | + | |
- | s.puts(" | + | |
- | + | ||
- | len=s.read(2).reverse.unpack(" | + | |
- | 2.times {s.getc } | + | |
- | + | ||
- | puts "Len: # | + | |
- | jpeg=s.read(len) | + | |
- | + | ||
- | puts " | + | |
- | + | ||
- | img=Magick:: | + | |
- | + | ||
- | puts " | + | |
- | img.write(" | + | |
- | + | ||
- | } | + | |
- | </ | + | |
- | + | ||
- | You can get images from your camera with my PHP script and a web server in the following form: | + | |
- | | + | |
- | + | ||
- | <code php> | + | |
- | <? | + | |
- | + | ||
- | | + | |
- | $pass = " | + | |
- | $ip = " | + | |
- | $port = " | + | |
- | + | ||
- | // 120 byte | + | |
- | // 3x 0x00, | + | |
- | // 1x 0x01, | + | |
- | // user name | + | |
- | // 1x 0x00, | + | |
- | // password, | + | |
- | // Nx 0x00, | + | |
- | | + | |
- | " | + | |
- | (120 - 3 - 1 - strlen($login) - 1 - strlen($pass)), | + | |
- | " | + | |
- | // 120 byte | + | |
- | // 3x 0x00, | + | |
- | // 1x 0x0e, | + | |
- | // Nx 0x00, | + | |
- | | + | |
- | + | ||
- | | + | |
- | + | ||
- | | + | |
- | { | + | |
- | global $sock; | + | |
- | + | ||
- | if ($sock) { | + | |
- | fclose($sock); | + | |
- | } | + | |
- | die($msg); | + | |
- | } | + | |
- | + | ||
- | | + | |
- | { | + | |
- | $ret = fwrite($sock, | + | |
- | if (!$ret) { | + | |
- | error(" | + | |
- | } | + | |
- | if ($ret != $len) { | + | |
- | error(" | + | |
- | } | + | |
- | fflush($sock); | + | |
- | } | + | |
- | + | ||
- | /* | + | |
- | | + | |
- | { | + | |
- | $f = fopen($file, | + | |
- | if (!$f) { | + | |
- | error(" | + | |
- | } | + | |
- | $ret = fwrite($f, $data); | + | |
- | if (!$ret) { | + | |
- | error(" | + | |
- | } | + | |
- | fclose($f); | + | |
- | } | + | |
- | */ | + | |
- | + | ||
- | $sock = fsockopen(" | + | |
- | if (!$sock) { | + | |
- | error(" | + | |
- | } | + | |
- | // 350ms | + | |
- | | + | |
- | + | ||
- | | + | |
- | // | + | |
- | + | ||
- | $ret = stream_get_contents($sock, | + | |
- | // | + | |
- | if (strlen($ret) != 120) { | + | |
- | error(" | + | |
- | } | + | |
- | // | + | |
- | | + | |
- | if ($reply[1] != $login_ok_reply) { | + | |
- | error(" | + | |
- | } | + | |
- | // | + | |
- | + | ||
- | | + | |
- | // | + | |
- | + | ||
- | // 6 fix byte | + | |
- | $ret = fread($sock, | + | |
- | if (!$ret) { | + | |
- | error(" | + | |
- | } | + | |
- | // | + | |
- | $sig = unpack(" | + | |
- | if ($sig[1] != " | + | |
- | error(" | + | |
- | } | + | |
- | // | + | |
- | + | ||
- | // 2 byte: jpeg size. | + | |
- | $ret = fread($sock, | + | |
- | if (!$ret) { | + | |
- | error(" | + | |
- | } | + | |
- | // | + | |
- | | + | |
- | | + | |
- | // | + | |
- | + | ||
- | // 20 byte ???. | + | |
- | $ret = fread($sock, | + | |
- | if (!$ret) { | + | |
- | error(" | + | |
- | } | + | |
- | + | ||
- | // JPEG: $frame_size byte. | + | |
- | | + | |
- | if (!$ret) { | + | |
- | error(" | + | |
- | } | + | |
- | if (strlen($ret) != $frame_size) { | + | |
- | error(" | + | |
- | " | + | |
- | } | + | |
- | + | ||
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | + | ||
- | | + | |
- | ?></ | + | |
- | + | ||
- | + | ||
- | Uff! Finally, habs ichs rausgefunden: | + | |
- | < | + | |
- | // Bild: | + | |
- | http:// | + | |
- | // stream: | + | |
- | http:// | + | |
- | </ | + | |
+ | [[webcam: |