I have only just realised what a misnomer the term ‘webcam’ is but can’t seem to think of something better. Anyway quick post to upload a Python ‘Webcam’ HTTP Streamer.
I found mjpg-streamer but it wasn’t quite right –
- I had to compile (cross-compile!) it each time I wanted to use it (hard to share…)
- I couldn’t embed it easily with existing programs (to share same http port) etc.
- It seemed to use a lot of CPU when it had to compress the images using libjpeg
So I decided to ‘Google’ around and look for a V4L2 binding for Python and couldn’t seem to find anything… only did I realize Pygame has this inbuilt already but no one seems to mention it! So to keep things short, here it is :-
http://code.google.com/p/madox/source/browse/trunk/webcam_stream/webcam_stream.py
- http://<ipaddress>:8080/GetStream – This gets you the multipart/jpeg stream
- http://<ipaddress>:8080/GetImage – This gets you a single image
- http://<ipaddress>:8080/JSImage – This uses the single image interface and gets the images as fast as it can via JavaScript
Framerates, ports (default 8080 in above examples), resolutions are in the source file for you to customize – go for it.
Hi! thank you very much for this!