{"id":847,"date":"2011-06-13T01:15:42","date_gmt":"2011-06-12T14:15:42","guid":{"rendered":"http:\/\/www.madox.net\/blog\/?p=847"},"modified":"2011-06-13T01:15:42","modified_gmt":"2011-06-12T14:15:42","slug":"python-webcam-streamer","status":"publish","type":"post","link":"http:\/\/www.madox.net\/blog\/2011\/06\/13\/python-webcam-streamer\/","title":{"rendered":"Python Webcam Streamer"},"content":{"rendered":"<p>I have only just realised what a misnomer the term &#8216;webcam&#8217; is but can&#8217;t seem to think of something better. \u00a0Anyway quick post to upload a Python &#8216;Webcam&#8217; HTTP Streamer.<\/p>\n<p>I found <a href=\"http:\/\/sourceforge.net\/projects\/mjpg-streamer\/\" target=\"_blank\">mjpg-streamer<\/a> but it wasn&#8217;t quite right &#8211;<\/p>\n<ul>\n<li>I had to compile (cross-compile!) it each time I wanted to use it (hard to share&#8230;)<\/li>\n<li>I couldn&#8217;t embed it easily with existing programs (to share same http port) etc.<\/li>\n<li>It seemed to use a lot of CPU when it had to compress the images using libjpeg<\/li>\n<\/ul>\n<p>So I decided to &#8216;Google&#8217; around and look for a V4L2 binding for Python and couldn&#8217;t seem to find anything&#8230; only did I realize Pygame has this inbuilt already but no one seems to mention it! \u00a0So to keep things short, here it is :-<\/p>\n<p><a href=\"http:\/\/code.google.com\/p\/madox\/source\/browse\/trunk\/webcam_stream\/webcam_stream.py\">http:\/\/code.google.com\/p\/madox\/source\/browse\/trunk\/webcam_stream\/webcam_stream.py<\/a><\/p>\n<ul>\n<li>http:\/\/&lt;ipaddress&gt;:8080\/GetStream &#8211; This gets you the multipart\/jpeg stream<\/li>\n<li>http:\/\/&lt;ipaddress&gt;:8080\/GetImage &#8211; This gets you a single image<\/li>\n<li>http:\/\/&lt;ipaddress&gt;:8080\/JSImage &#8211; This uses the single image interface and gets the images as fast as it can via JavaScript<\/li>\n<\/ul>\n<p>Framerates, ports (default 8080 in above examples), resolutions are in the source file for you to customize &#8211; go for it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have only just realised what a misnomer the term &#8216;webcam&#8217; is but can&#8217;t seem to think of something better. \u00a0Anyway quick post to upload a Python &#8216;Webcam&#8217; HTTP Streamer. I found mjpg-streamer but it wasn&#8217;t quite right &#8211; I had to compile (cross-compile!) it each time I wanted to use it (hard to share&#8230;) &hellip; <a href=\"http:\/\/www.madox.net\/blog\/2011\/06\/13\/python-webcam-streamer\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Python Webcam Streamer&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-847","post","type-post","status-publish","format-standard","hentry","category-engineering"],"_links":{"self":[{"href":"http:\/\/www.madox.net\/blog\/wp-json\/wp\/v2\/posts\/847","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.madox.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.madox.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.madox.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.madox.net\/blog\/wp-json\/wp\/v2\/comments?post=847"}],"version-history":[{"count":1,"href":"http:\/\/www.madox.net\/blog\/wp-json\/wp\/v2\/posts\/847\/revisions"}],"predecessor-version":[{"id":848,"href":"http:\/\/www.madox.net\/blog\/wp-json\/wp\/v2\/posts\/847\/revisions\/848"}],"wp:attachment":[{"href":"http:\/\/www.madox.net\/blog\/wp-json\/wp\/v2\/media?parent=847"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.madox.net\/blog\/wp-json\/wp\/v2\/categories?post=847"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.madox.net\/blog\/wp-json\/wp\/v2\/tags?post=847"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}