{"id":641,"date":"2014-05-05T17:04:56","date_gmt":"2014-05-05T08:04:56","guid":{"rendered":"http:\/\/iphone-users.ddo.jp\/wordpress\/?p=641"},"modified":"2015-01-30T16:10:21","modified_gmt":"2015-01-30T07:10:21","slug":"ubuntu12-04%e3%81%a7%e6%a7%8b%e7%af%89%e3%81%97%e3%81%9fweb%e3%82%ab%e3%83%a1%e3%83%a9%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%9f%e7%9b%a3%e8%a6%96%e3%82%ab%e3%83%a1%e3%83%a9%e3%81%ae%e8%a8%ad%e5%ae%9a","status":"publish","type":"post","link":"https:\/\/iphone-users.ddo.jp\/wordpress\/?p=641","title":{"rendered":"ubuntu12.04\u3067\u69cb\u7bc9\u3057\u305fWeb\u30ab\u30e1\u30e9\u3092\u4f7f\u3063\u305f\u76e3\u8996\u30ab\u30e1\u30e9\u306e\u8a2d\u5b9a\u30e1\u30e2"},"content":{"rendered":"<p>ubuntu12.04\u3092\u4f7f\u3063\u305f\u76e3\u8996\u30ab\u30e1\u30e9\u30b7\u30b9\u30c6\u30e0\u306f\u52d5\u4f53\u691c\u51fa\u3055\u308c\u305f\u6642\u306b\u52d5\u753b\u306b\u5909\u63db\u3057\u3066\u30e1\u30fc\u30eb\u3067\u9001\u4fe1\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u305f\u3002VLC Player\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066Web\u30ab\u30e1\u30e9\u304c\u4f7f\u3048\u308b\u304b\u3092\u78ba\u8a8d\u3057\u305f\u3002<\/p>\n<p>\u30e1\u30c7\u30a3\u30a2\u3092\u958b\u304f\u3001\u30ad\u30e3\u30d7\u30c1\u30e3\u30fc\u30c7\u30d0\u30a4\u30b9\u30c0\u30d6\u306e\u30d3\u30c7\u30aa\u30c7\u30d0\u30a4\u30b9\u540d\u306b\/dev\/video0\u304c\u9078\u629e\u3067\u304d\u308c\u3070Web\u30ab\u30e1\u30e9\u306f\u8a8d\u8b58\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u518d\u751f\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u30ab\u30e1\u30e9\u306e\u30b9\u30c8\u30ea\u30fc\u30df\u30f3\u30b0\u753b\u50cf\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\uff11\uff0e\u52d5\u4f5c\u691c\u51fa\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u305f V4L \u30ad\u30e3\u30d7\u30c1\u30e3\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3002<\/p>\n<p>root\u306e\u30bf\u30fc\u30df\u30ca\u30eb\u3067apt-get install motion<\/p>\n<p>\u30e6\u30fc\u30b6\u30fc\u306e\u30bf\u30fc\u30df\u30ca\u30eb\u3067motion\u3092\u5b9f\u884c\u3059\u308b\u3068home\u30d5\u30a9\u30eb\u30c0\u306b\u52d5\u4f53\u76e3\u8996\u3057\u305f\u30c7\u30fc\u30bf\u3092\u66f8\u304d\u51fa\u3057\u307e\u3059\u3002root\u306e\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u5b9f\u884c\u3059\u308b\u3068\/tmp\/motion\u306b\u30c7\u30fc\u30bf\u3092\u66f8\u304d\u51fa\u3057\u307e\u3059\u304c\u6700\u5f8c\u306b\u307e\u3068\u3081\u3067\u3059\u3079\u3066\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p>\uff12\uff0e\u691c\u51fa\u6642\u306b\u4f5c\u6210\u3057\u305f\u52d5\u753b\u30d5\u30a1\u30a4\u30eb\u3092\u30e1\u30fc\u30eb\u3067\u9001\u308b\u305f\u3081mutt\u3068Gmail\u3092\u4f7f\u3063\u3066\u30e1\u30fc\u30eb\u9001\u4fe1\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>root\u306e\u30bf\u30fc\u30df\u30ca\u30eb\u3067apt-get mutt<\/p>\n<p>\u203b\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u8a2d\u5b9a\u753b\u9762\u3067\u4e86\u89e3\u3092\u9078\u3093\u3067\u3001\u30e1\u30fc\u30eb\u8a2d\u5b9a\u306e\u4e00\u822c\u5f62\u5f0f\u3067\u306f\u8a2d\u5b9a\u306a\u3057\u3092\u9078\u3073\u4e86\u89e3\u3057\u307e\u3059\u3002<\/p>\n<p>\/path\/to\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3057\u3066\u3053\u306e\u4e2d\u306bmutt.conf\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306bGmail\u3092\u4f7f\u3063\u3066\u30e1\u30fc\u30eb\u9001\u4fe1\u3059\u308b\u305f\u3081\u306e\u6700\u4f4e\u9650\u306e\u8a2d\u5b9a\u3092\u66f8\u304d\u307e\u3059\u3002\u5185\u5bb9\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n<p>set charset=&#8221;utf-8&#8243;<br \/>\nset send_charset=&#8221;us-ascii:iso-2022-jp&#8221;<\/p>\n<p>set from = &#8220;webcam\u7528\u30a2\u30ab\u30a6\u30f3\u30c8@gmail.com&#8221;<br \/>\nset realname = &#8220;\u6c0f\u540d&#8221;<\/p>\n<p>set smtp_url = &#8220;smtp:\/\/webcam\u7528\u30a2\u30ab\u30a6\u30f3\u30c8@smtp.gmail.com:587\/&#8221;<br \/>\nset smtp_pass = &#8220;webcam\u7528\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u30d1\u30b9\u30ef\u30fc\u30c9&#8221;<\/p>\n<p>\u6e96\u5099\u304c\u3067\u304d\u305f\u3089\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3067\u52d5\u4f5c\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<p>$ echo &#8220;Hello world&#8221; | mutt -F \/path\/to\/mutt.conf -s &#8220;\u4ef6\u540d&#8221; \u5b9b\u5148@gmail.com<\/p>\n<p>\u540c\u3058\u30d5\u30a9\u30eb\u30c0\u306bmotion\u304b\u3089\u547c\u3073\u51fa\u3059\u30b7\u30a7\u30eb(movie_end.sh)\u3092\u6b21\u306e\u3088\u3046\u306a\u5185\u5bb9\u3067\u7528\u610f\u3057\u307e\u3059\u3002<\/p>\n<p>#!\/bin\/sh<br \/>\nAVI_PATH=$1<br \/>\nAVI_DIR=`dirname $AVI_PATH`<br \/>\nMP4_NAME=&#8221;MOTION-`date +&#8217;%Y%m%d-%H%M%S&#8217;`.mp4&#8243;<br \/>\nMP4_PATH=$AVI_DIR\/$MP4_NAME<\/p>\n<p>EMAIL_TO=\u901a\u77e5\u30fb\u9001\u4fe1\u5148@gmail.com<br \/>\nEMAIL_SUB=&#8221;\u76e3\u8996\u30ab\u30e1\u30e9&#8221;<br \/>\nEMAIL_BODY=&#8221;\u52d5\u4f53\u3092\u691c\u77e5\u3057\u307e\u3057\u305f&#8221;<br \/>\nMUTT_CONF=\/path\/to\/mutt.conf<\/p>\n<p># convert to mp4<br \/>\nffmpeg -i $AVI_PATH -f mp4 -s 320&#215;240 -vcodec mpeg4 -b 3000k -acodec aac -ab 128k \u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000$MP4_PATH &gt; \/dev\/null 2&gt;&amp;1<\/p>\n<p>if [ $? -eq 0 ]; then<br \/>\n# send email by mutt &amp; gmail<br \/>\necho $EMAIL_BODY | mutt -F $MUTT_CONF -s $EMAIL_SUB -a $MP4_PATH &#8212; $EMAIL_TO<br \/>\nif [ $? -eq 0 ]; then<br \/>\n# clean up old motion files (over 60 minnutes)<br \/>\nfind $AVI_DIR -type f -mmin +60 | xargs rm -rf<br \/>\nfi<br \/>\nfi<\/p>\n<p>&nbsp;<\/p>\n<p>motion\u81ea\u4f53\u304b\u3089\u52d5\u753b\u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30b9\u3092\u53d6\u5f97\u3067\u304d\u308b\u306e\u3067\u3001\u5f15\u6570\uff08$1\uff09\u3068\u3057\u3066\u53d6\u5f97\u3057\u3001avi\u5f62\u5f0f\u306e\u30d5\u30a1\u30a4\u30eb\u3092mp4\u306b\u5909\u63db\u5f8c\u3001mutt\u3067\u30e1\u30fc\u30eb\u9001\u4fe1\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>motion\u306e\u8a2d\u5b9a\u3000\/etc\/motion\/motion.conf\u7de8\u96c6\u3057\u307e\u3059\u3002<\/p>\n<p>\u2460\u30d5\u30ec\u30fc\u30e0\u30ec\u30fc\u30c8\u306e\u8a2d\u5b9a<br \/>\n\uff11\u79d2\u9593\u306b\u64ae\u5f71\u3059\u308b\u30d5\u30ec\u30fc\u30e0\u6570\u3092\u5909\u66f4\u3057\u307e\u3059\u3002\u6a19\u6e96\u3067\u306f\uff12\u3067\u3059\u304c\u3001\u3053\u3053\u3067\u306f30fps\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p># Maximum number of frames to be captured per second.<br \/>\n# Valid range: 2-100. Default: 100 (almost no limit).<br \/>\nframerate 30<\/p>\n<p>\u2461\u30a4\u30e1\u30fc\u30b8\u30fb\u30b5\u30a4\u30ba<br \/>\nwidth, height\u3067\u30b5\u30a4\u30ba\u3092\u6307\u5b9a\u3067\u304d\u307e\u3059\u3002<\/p>\n<p># Image width (pixels). Valid range: Camera dependent<br \/>\nwidth 320<\/p>\n<p># Image height (pixels). Valid range: Camera dependent<br \/>\nheight 240<\/p>\n<p>\u2462\u52d5\u4f53\u691c\u77e5\u3057\u304d\u3044\u5024<br \/>\nMotion\u306f\u64ae\u5f71\u3057\u305f\u753b\u50cf\u3092\u6bd4\u8f03\u3057\u3001\u5909\u5316\u3057\u305f\u30d4\u30af\u30bb\u30eb\u6570\u3092\u57fa\u6e96\u306b\u52d5\u4f53\u691c\u77e5\u3057\u307e\u3059\u3002\u3053\u306e\u691c\u77e5\u57fa\u6e96\u3068\u306a\u308b\u30d4\u30af\u30bb\u30eb\u6570\u3001\u6a19\u6e96\u3067\u306f1500\u3067\u3059\u304c\u3001300\u306b\u3057\u3066\u611f\u5ea6\u3092\u4e0a\u3052\u307e\u3059\u3002<\/p>\n<p># Threshold for number of changed pixels in an image that<br \/>\n# triggers motion detection (default: 1500)<br \/>\nthreshold 300<\/p>\n<p>\u2463\u30ce\u30fc\u30e2\u30fc\u30b7\u30e7\u30f3\u691c\u77e5\u3057\u304d\u3044\u5024<br \/>\n\u52d5\u4f53\u691c\u77e5\u7d42\u4e86\u3092\u5224\u65ad\u3059\u308b\u70ba\u306b\u30ce\u30fc\u30e2\u30fc\u30b7\u30e7\u30f3\u306e\u9023\u7d9a\u7d99\u7d9a\u6642\u9593\u3092gap\u3068\u3057\u3066\u8a2d\u5b9a\u3057\u307e\u3059\u3002<br \/>\n\u3053\u306e\u5024\u304c\u5927\u304d\u3044\u3068\u3001\u691c\u77e5\u983b\u5ea6\u306f\u5c11\u304f\u306a\u308a\u307e\u3059\u304c\u3001\u751f\u6210\u3055\u308c\u308b\u52d5\u753b\u30d5\u30a1\u30a4\u30eb\u306f\u5927\u304d\u304f\u306a\u308a\u307e\u3059\u3002\u9006\u306b\u77ed\u3044\u3068\u751f\u6210\u3055\u308c\u308b\u52d5\u753b\u30d5\u30a1\u30a4\u30eb\u306f\u5c0f\u3055\u304f\u306a\u308a\u307e\u3059\u304c\u3001\u691c\u77e5\u983b\u5ea6\u306f\u591a\u304f\u306a\u308a\u307e\u3059\u3002<br \/>\n\u6a19\u6e96\u3067\u306f\u9023\u7d9a60\u79d2\u3067\u3059\u304c\u3001\u4eca\u56de\u306f\u30e1\u30fc\u30eb\u306b\u52d5\u753b\u30d5\u30a1\u30a4\u30eb\u3092\u6dfb\u4ed8\u3057\u305f\u3044\u306e\u306710\uff5e30\u79d2\u7a0b\u5ea6\u306b\u3057\u307e\u3059\u3002<\/p>\n<p># Gap is the seconds of no motion detection that triggers the end of an event<br \/>\n# An event is defined as a series of motion images taken within a short timeframe.<br \/>\n# Recommended value is 60 seconds (Default). The value 0 is allowed and disables<br \/>\n# events causing all Motion to be written to one single mpeg file and no pre_capture.<br \/>\ngap 30<\/p>\n<p>\u2464\u30b3\u30fc\u30c7\u30c3\u30af\u306e\u6307\u5b9a<br \/>\nffmpeg_video_codec\u3067\u52d5\u753b\u30d5\u30a1\u30a4\u30eb\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u6a19\u6e96\u3067\u306fswf\u3067\u3059\u304c\u3001\u4eca\u56de\u306fmpeg4\uff08\u4f5c\u6210\u3055\u308c\u308b\u30d5\u30a1\u30a4\u30eb\u306favi\u5f62\u5f0f\uff09\u306b\u5909\u66f4\u3002<\/p>\n<p># Codec to used by ffmpeg for the video compression.<br \/>\n# Timelapse mpegs are always made in mpeg1 format independent from this option.<br \/>\n# Supported formats are: mpeg1 (ffmpeg-0.4.8 only), mpeg4 (default), and msmpeg4.<br \/>\n# mpeg1 &#8211; gives you files with extension .mpg<br \/>\n# mpeg4 or msmpeg4 &#8211; gives you files with extension .avi<br \/>\n# msmpeg4 is recommended for use with Windows Media Player because<br \/>\n# it requires no installation of codec on the Windows client.<br \/>\n# swf &#8211; gives you a flash film with extension .swf<br \/>\n# flv &#8211; gives you a flash video with extension .flv<br \/>\n# ffv1 &#8211; FF video codec 1 for Lossless Encoding ( experimental )<br \/>\n# mov &#8211; QuickTime ( testing )<\/p>\n<p>ffmpeg_video_codec mpeg4<\/p>\n<p>\u2465\u9332\u753b\u7d42\u4e86\u30a4\u30d9\u30f3\u30c8\u767a\u751f\u6642\u306e\u30a2\u30af\u30b7\u30e7\u30f3\u5b9f\u884c\uff08\u30e1\u30fc\u30eb\u9001\u4fe1\uff09<br \/>\n\u52d5\u4f53\u691c\u77e5\u30fb\u9332\u753b\u7d42\u4e86\u3057\u305f\u6642\u70b9\u3067\u547c\u3073\u51fa\u3059\u51e6\u7406\u3092value\u90e8\u5206\u306b\u8a2d\u5b9a\u3057\u307e\u3059\u3002\u3053\u306e\u90e8\u5206\u306f\u5f8c\u8ff0\u3002<\/p>\n<p># Command to be executed when a movie file (.mpg|.avi) is closed. (default: none)<br \/>\n# To give the filename as an argument to a command append it with %f<br \/>\non_movie_end movie_end.sh \u3068\u3057\u307e\u3059\u3002<\/p>\n<p>\u2466\u305d\u306e\u4ed6<\/p>\n<p>#output_normal on<br \/>\noutput_normal off\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u3092\u4fdd\u5b58\u3057\u306a\u3044<\/p>\n<p>#target_dir \/tmp\/motion<br \/>\ntarget_dir \/var\/www\u4fdd\u5b58\u3059\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea<\/p>\n<p>#webcam_quality 50<br \/>\nwebcam_quality 100\u30e9\u30a4\u30d6\u753b\u50cf\u306e\u753b\u8cea<\/p>\n<p>#webcam_localhost on<br \/>\nwebcam_localhost off\u30ed\u30fc\u30ab\u30eb\u30db\u30b9\u30c8\u4ee5\u5916\u3082\u30e9\u30a4\u30d6\u6620\u50cf\u3092\u914d\u4fe1<\/p>\n<p>\u3042\u3068\u306f\u30bf\u30fc\u30df\u30ca\u30eb\u304b\u3089sodo motion\u307e\u305f\u306froot\u306e\u30bf\u30fc\u30df\u30ca\u30eb\u4e0a\u3067motion\u3092\u5b9f\u884c\u3059\u308b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ubuntu12.04\u3092\u4f7f\u3063\u305f\u76e3\u8996\u30ab\u30e1\u30e9\u30b7\u30b9\u30c6\u30e0\u306f\u52d5\u4f53\u691c\u51fa\u3055\u308c\u305f\u6642\u306b\u52d5\u753b\u306b\u5909\u63db\u3057\u3066\u30e1\u30fc\u30eb\u3067\u9001\u4fe1\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u305f\u3002VLC Player\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066Web\u30ab\u30e1\u30e9\u304c\u4f7f\u3048\u308b\u304b\u3092\u78ba\u8a8d\u3057\u305f\u3002 \u30e1\u30c7\u30a3\u30a2\u3092\u958b\u304f\u3001\u30ad\u30e3\u30d7\u30c1\u30e3\u30fc\u30c7\u30d0\u30a4 &#8230;<\/p>\n<p><a href=\"https:\/\/iphone-users.ddo.jp\/wordpress\/?p=641\" class=\"more-link\">Continue reading &lsquo;ubuntu12.04\u3067\u69cb\u7bc9\u3057\u305fWeb\u30ab\u30e1\u30e9\u3092\u4f7f\u3063\u305f\u76e3\u8996\u30ab\u30e1\u30e9\u306e\u8a2d\u5b9a\u30e1\u30e2&rsquo; &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-641","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/iphone-users.ddo.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/641","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/iphone-users.ddo.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/iphone-users.ddo.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/iphone-users.ddo.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/iphone-users.ddo.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=641"}],"version-history":[{"count":5,"href":"https:\/\/iphone-users.ddo.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/641\/revisions"}],"predecessor-version":[{"id":962,"href":"https:\/\/iphone-users.ddo.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/641\/revisions\/962"}],"wp:attachment":[{"href":"https:\/\/iphone-users.ddo.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=641"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/iphone-users.ddo.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=641"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/iphone-users.ddo.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=641"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}