{"id":485,"date":"2011-01-28T00:30:38","date_gmt":"2011-11-30T13:51:50","guid":{"rendered":"http:\/\/kraftek.com\/blog\/stream-a-webcam-using-highly-compressed-h264-instead-of-typical-mpg\/"},"modified":"2011-01-28T00:30:38","modified_gmt":"2011-11-30T13:51:50","slug":"stream-a-webcam-using-highly-compressed-h264-instead-of-typical-mpg","status":"publish","type":"post","link":"\/blog\/index.php\/stream-a-webcam-using-highly-compressed-h264-instead-of-typical-mpg\/","title":{"rendered":"stream a webcam, using highly compressed h264 instead of typical mpg"},"content":{"rendered":"<p>Got a logitech webcam c300, it uses the &#8220;uvcvideo&#8221; kernel module.<br \/>\nTypically you would grab video using &#8220;motion&#8221; and stream it on mpeg, well that&#8217;s rubbish if you want better<br \/>\ncompression, so let&#8217;s do it using the best of the best: h264.<br \/>\n#!\/bin\/ksh<br \/>\nDEV=\/dev\/logitechcam<br \/>\nps -ef | grep -i vlc | grep -v grep |grep -i logitechcam | awk &#8216;{ print $2 }&#8217;| while read P;do<br \/>\nkill -9 $P<br \/>\ndone<br \/>\nVLC=&#8221;\/usr\/local\/bin\/cvlc v4l2:\/\/$DEV :input=2 :input-slave=alsa:\/\/hw:2,0 &#8211;alsa-samplerate=32000<br \/>\n&#8211;v4l2-controls-reset &#8211;v4l2-auto-white-balance=1 &#8211;v4l2-do-white-balance=1 &#8211;v4l2-autogain=1 &#8211;sout &#8221;<br \/>\n21\/433<br \/>\nCAM=&#8221;transcode{vcodec=h264,acodec=mp4a,width=320,height=240,vb=64,ab=24,channels=1,venc=x264}:standard{access=http,dst=0.0.0.0:8090\/stream.flv}&#8221;<br \/>\n22\/433<br \/>\n23\/433<br \/>\n#CAM=&#8221;transcode{vcodec=mjpg,width=320,height=240}:duplicate{dst=std{access=http{mime=multipart\/x-mixed-replace;boundary=&#8211;7b3cc56e5f51db803f790dad720ed50a}.mux=mpjpeg,dst=0.0.0.0:8090\/m.mjpg}}&#8221;<br \/>\n${VLC} &#8220;#$CAM&#8221;<br \/>\nthis produces a very decent quality stream at around 100kbps, audio also included!<br \/>\nEnjoy!<br \/>\n24\/433<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Got a logitech webcam c300, it uses the &#8220;uvcvideo&#8221; kernel module. Typically you would grab video using &#8220;motion&#8221; and stream it on mpeg, well that&#8217;s rubbish if you want better compression, so let&#8217;s do it using the best of the best: h264. #!\/bin\/ksh DEV=\/dev\/logitechcam ps -ef | grep -i vlc | grep -v grep |grep [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-485","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts\/485","targetHints":{"allow":["GET"]}}],"collection":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=485"}],"version-history":[{"count":0,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts\/485\/revisions"}],"wp:attachment":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=485"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=485"},{"taxonomy":"post_tag","embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=485"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}