{"id":3533,"date":"2015-12-06T21:15:43","date_gmt":"2015-12-07T02:15:43","guid":{"rendered":"http:\/\/www.summet.com\/blog\/?p=3533"},"modified":"2015-12-06T21:19:37","modified_gmt":"2015-12-07T02:19:37","slug":"ubuntu-14-04-mjpg_streamer-install-attempt","status":"publish","type":"post","link":"https:\/\/www.summet.com\/blog\/2015\/12\/06\/ubuntu-14-04-mjpg_streamer-install-attempt\/","title":{"rendered":"Ubuntu 14.04 mjpg_streamer install attempt"},"content":{"rendered":"<p>I tried installing mjpg_streamer on Ubuntu 14.04 to allow me to stream a USB webcam over the internet (or your local network) to web browsers or other IP based systems that read mjpeg streams.<br \/>\n<!--more--><\/p>\n<p>The nice thing about mjpg_streamer is that if your webcam can deliver a mjpeg stream, it will turn around and stream it over the web using very little CPU power for transcoding.<\/p>\n<p>Unfortunately, my old <a href=\"http:\/\/www.summet.com\/blog\/2010\/08\/01\/philips-spc-900nc-webcam-linux-zoneminder-compatable\/\">Philips webcam<\/a> does not generate an MJPEG stream, and the video format it does generate isn&#8217;t quite compatible to even allow mjpg_streamer to display a good image. But what I tried is documented below:<\/p>\n<p>Installation:<br \/>\n<code><br \/>\nsudo add-apt-repository ppa:altair-ibn-la-ahad\/mjpg-streamer<br \/>\nsudo apt-get update<br \/>\nsudo apt-get install mjpg-streamer<br \/>\n<\/code><\/p>\n<p>Trying to figure out where the www files are:<br \/>\n<code><br \/>\ndpkg-query -L mjpg-streamer<br \/>\n<\/code><\/p>\n<p>The README file tells me that you have to make your own&#8230;or just use the following URLs directly (replacing 127.0.0.1 with the IP address of the server if your server is different from the localhost):<\/p>\n<p>To view the stream use VLC or Firefox and open the URL:<br \/>\nhttp:\/\/127.0.0.1:8080\/?action=stream<\/p>\n<p>To view a single JPEG just call:<br \/>\nhttp:\/\/127.0.0.1:8080\/?action=snapshot<\/p>\n<p>Then I found out that the image served by my webcam by default had errors&#8230;.<\/p>\n<p>\/?action=stream&#8221; cannot be displayed because it has errors<\/p>\n<p>Due to the fact that it didn&#8217;t produce motion-jpeg streams directly, and instead produced raw (not quite YUV) streams, so I had to add a &#8220;-yuv&#8221; option to the input plugin.<\/p>\n<p>I figured this out by reading the &#8216;documentation&#8217; for the input plugin here.<br \/>\n<code>mjpg_streamer -i \"input_uvc.so --help\"<\/code><\/p>\n<p>This produced an image, but the colors were all off (very green) and the image showed duplicate images which means that the web cam isn&#8217;t exactly producing the correct YUV format that mpjg_streamer is expecting.  I believe an experimental branch of mpjg_streamer may be supporting this, but I didn&#8217;t want to install from source, so I switched over to trying to use motion instead.<\/p>\n<p>Here is my final command line running it (on your first USB webcam), default streaming (to port 8080).<\/p>\n<p><code><br \/>\n mjpg_streamer -i \"input_uvc.so -yuv  -d \/dev\/video0\" -o \"output_http.so\"<br \/>\n<\/code><\/p>\n<p>Commands to clean things up:<\/p>\n<p><code><br \/>\n sudo apt-get remove mjpg-streamer<br \/>\n sudo add-apt-repository --remove ppa:altair-ibn-la-ahad\/mjpg-streamer<br \/>\n<\/code><\/p>\n<p>I went on to <a href=\"http:\/\/www.summet.com\/blog\/2015\/12\/06\/streaming-usb-webcam-to-the-web-with-motion-on-ubuntu-14-04\/\">use the &#8220;motion&#8221; program to transcode into mjpg format and stream the webcam&#8217;s output over HTTP<\/a>. (It also detects motion and saves local snapshots of motion frames as a side effect \/ extra feature?)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I tried installing mjpg_streamer on Ubuntu 14.04 to allow me to stream a USB webcam over the internet (or your local network) to web browsers or other IP based systems that read mjpeg streams.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-3533","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/posts\/3533","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/comments?post=3533"}],"version-history":[{"count":6,"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/posts\/3533\/revisions"}],"predecessor-version":[{"id":3554,"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/posts\/3533\/revisions\/3554"}],"wp:attachment":[{"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/media?parent=3533"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/categories?post=3533"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/tags?post=3533"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}