{"id":2323,"date":"2018-11-01T21:53:59","date_gmt":"2018-11-01T12:53:59","guid":{"rendered":"https:\/\/uda2.com\/blog\/?p=2323"},"modified":"2023-07-07T16:06:23","modified_gmt":"2023-07-07T07:06:23","slug":"raspberry-pi-camera1","status":"publish","type":"post","link":"https:\/\/uda2.com\/blog\/raspberry-pi-camera1\/","title":{"rendered":"Raspberry Pi\u3067\u76e3\u8996\u30ab\u30e1\u30e91 \u6e96\u5099\u7de8"},"content":{"rendered":"<p><a href=\"https:\/\/www.amazon.co.jp\/exec\/obidos\/ASIN\/B01ER2SKFS\/myrelease-22\/ref=nosim\" target=\"_blank\" rel=\"noopener\">Raspberry Pi Camera Module V2<\/a>\u3092\u30b2\u30c3\u30c8\u3057\u305f\u3002<br \/>\n\u6628\u4eca\u5b89\u4fa1\u3067\u9ad8\u6a5f\u80fd\u306a\u4e2d\u83ef\u88fd\u306eIP\u30ab\u30e1\u30e9\u304c\u3042\u308b\u304c\u4e0d\u5b89\u5b9a\u3067\u3059\u3050\u58ca\u308c\u308b\uff081\u5e74\u3050\u3089\u3044\u3067\u58ca\u308c\u305f\uff09\u3057\u4f55\u3088\u308a\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u7684\u306b\u602a\u3057\u3044\u306e\u3067\u6c17\u8efd\u306b\u306f\u4f7f\u3048\u306a\u3044\u3002\u305d\u3053\u3067Raspberry Pi Zero W\u306b\u5165\u308c\u3066\u76e3\u8996\u30ab\u30e1\u30e9\u3092\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n<!--more--><br \/>\n\u307e\u305a\u306f\u63a5\u7d9a\u3057\u3066\u8a66\u3057\u64ae\u308a\u3057\u3066\u3044\u304d\u307e\u3059\u3002<br \/>\n\u96fb\u6e90\u304c\u5207\u308c\u305f\u72b6\u614b\u3067\u30ab\u30e1\u30e9\u3092\u63a5\u7d9a\u3057\u307e\u3059\u3002Raspberry Pi Zero W\u306b\u4ed8\u3044\u3066\u304d\u305f\u5148\u7d30\u306e\u30b1\u30fc\u30d6\u30eb\u3092\u4ed8\u3051\u96fb\u6e90\u3092\u5165\u308c\u307e\u3059\u3002<br \/>\n\u6a19\u6e96\u3067\u306f\u30ab\u30e1\u30e9\u6a5f\u80fd\u304cOFF\u306a\u3063\u3066\u308b\u306e\u3067\u30e9\u30ba\u30d1\u30a4\u8a2d\u5b9a\u30c4\u30fc\u30eb\u3067ON\u306b\u3057\u3066\u3044\u304d\u307e\u3059\u3002<br \/>\n<strong>$ sudo raspi-config<\/strong><br \/>\n5 Interfacing Options \u2192 P1 Camera\u304b\u3089\u6709\u52b9\u306b\u3059\u308b\u3060\u3051\u3067\u3059\u3002<br \/>\n\u4ee5\u524d10\u5e74\u3050\u3089\u3044\u524d\u306eUSB\u30ab\u30e1\u30e9\uff08NET COWBOY DC-NCR13U\uff09\u3092\u4f7f\u3063\u3066\u307f\u305f\u4e8b\u304c\u3042\u3063\u305f\u306e\u3067\u3059\u304c\u305d\u306e\u6642\u306ffswebcam\u3068\u304b\u3044\u3046\u30ad\u30e3\u30d7\u30c1\u30e3\u30bd\u30d5\u30c8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u8a66\u3057\u64ae\u308a\u3057\u305f\u306e\u3067\u3059\u304c\u3001\u4eca\u56de\u306fRaspberry Pi\u7528\u306e\u30ab\u30e1\u30e9\u306a\u306e\u3067raspistill\u3084raspivid\u3068\u3044\u3063\u305f\u5c02\u7528\u30bd\u30d5\u30c8\u304c\u6700\u521d\u304b\u3089\u7528\u610f\u3055\u308c\u3066\u3044\u305f\u3002<br \/>\n\u307e\u305a\u306f\u753b\u50cf<br \/>\n<strong>$ raspistill -o image.jpg<\/strong><br \/>\n<strong>$ raspistill -o image.jpg -w 1024 -h 768<\/strong><br \/>\n\u6b21\u306b\u52d5\u753b\u3092\u64ae\u5f71<br \/>\n<strong>$ raspivid -o video.h264<\/strong><br \/>\n\u52d5\u753b\u306f\u666e\u901a\u306e\u518d\u751f\u30bd\u30d5\u30c8\u3067\u306f\u898b\u308c\u306a\u3044\u5f62\u5f0f\u3067\u9332\u753b\u3055\u308c\u308b\u306e\u3067MP4Box\u3092\u3064\u304b\u3063\u3066mp4\u306b\u5909\u63db\u3057\u3066\u78ba\u8a8d\u3057\u307e\u3057\u305f\u3002<br \/>\n<strong>$ sudo apt-get install gpac<\/strong><br \/>\n<strong>$ MP4Box -fps 30 -add video.h264 video.mp4<\/strong><\/p>\n<p>\u78ba\u8a8d\u304c\u7d42\u308f\u3063\u305f\u306e\u3067\u3053\u3053\u304b\u3089\u3044\u3088\u3044\u3088\u76e3\u8996\u30ab\u30e1\u30e9\u5316\u3057\u307e\u3059\u3002<br \/>\n\u5ff5\u306e\u305f\u3081\u30bd\u30d5\u30c8\u3092\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3057\u3066\u304a\u304d\u307e\u3059<br \/>\n<strong>$ sudo apt-get update<\/strong><br \/>\n<strong>$ sudo apt-get upgrade <\/strong><\/p>\n<p>\u76e3\u8996\u30ab\u30e1\u30e9\u30bd\u30d5\u30c8motion\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<br \/>\n<strong>$ sudo apt-get install motion<\/strong><br \/>\n<strong>$ sudo vi \/etc\/default\/motion<\/strong><\/p>\n<pre><code>start_motion_daemon=yes<\/code><\/pre>\n<p>\u30c7\u30fc\u30bf\u306e\u4fdd\u5b58\u30d5\u30a9\u30eb\u30c0\u3092\u7528\u610f\u3057\u307e\u3059\u3002<br \/>\n<strong>$ sudo mkdir \/var\/motion<\/strong><br \/>\n<strong>$ sudo chmod 764 \/var\/motion<\/strong><br \/>\n<strong>$ sudo chown pi:pi \/var\/motion<\/strong><\/p>\n<p>\u6b21\u306b\u8a2d\u5b9a\u3084\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5165\u308c\u308b\u30d5\u30a9\u30eb\u30c0\u3092\u7528\u610f\u3057\u307e\u3059\u3002<br \/>\n<strong>$ sudo mkdir \/var\/motion_setting<\/strong><br \/>\n<strong>$ sudo chown pi:pi \/var\/motion_setting<\/strong><\/p>\n<p>\u6a19\u6e96\u3067\u306fmotion\u3068\u3044\u3046\u30e6\u30fc\u30b6\u30fc\u3067\u66f8\u304d\u8fbc\u307f\u3059\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u3066\u8272\u3005\u3068\u9762\u5012\u306a\u306e\u3067\u5916\u3057\u3066\u30eb\u30fc\u30c8\u6a29\u9650\u3067\u66f8\u304d\u8fbc\u3080\u3088\u3046\u306b\u3057\u3066\u304a\u304f<br \/>\n<strong>$ sudo vi \/etc\/rc1.d\/K01motion<\/strong><\/p>\n<pre><code>if start-stop-daemon --start --oknodo --exec $DAEMON -b --chuid motion ; then\n\u2192\nif start-stop-daemon --start --oknodo --exec $DAEMON -b ; then<\/code><\/pre>\n<p>motion\u306e\u8a2d\u5b9a\u3092\u5909\u66f4\u3059\u308b<br \/>\n<strong>$ sudo vi \/etc\/motion\/motion.conf<\/strong><\/p>\n<pre><code>daemon on\ntarget_dir \/var\/motion\nwebcam_localhost off<\/code><\/pre>\n<p>\u898b\u6163\u308c\u306a\u3044\u5358\u8a9e\u3060\u3051\u3056\u3063\u304f\u308a\u89e3\u8aac\u3059\u308b\u3068<br \/>\n<em>daemon<\/em>\u306f\u81ea\u52d5\u8d77\u52d5\u3059\u308b\u304b<br \/>\n<em>target_dir<\/em>\u306f\u9332\u753b\u30c7\u30fc\u30bf\u306e\u4fdd\u5b58\u5834\u6240<br \/>\n<em>webcam_localhost<\/em>\u306f\u30b9\u30c8\u30ea\u30fc\u30df\u30f3\u30b0\u3059\u308b\u304b<\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u8d77\u52d5\u3057\u3066\u307f\u308b<br \/>\n<strong>$ sudo service motion start<\/strong><\/p>\n<p>\u4f55\u3082\u64ae\u5f71\u3055\u308c\u306a\u3044\u306e\u3067\u8abf\u3079\u3066\u307f\u305f\u3002<a href=\"https:\/\/qiita.com\/rukihena\/items\/95da3860f9ca86c39f8d\" target=\"_blank\" rel=\"noopener\">Raspberry Pi\u3068\u7d14\u6b63\u30ab\u30e1\u30e9\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u76e3\u8996\u30ab\u30e1\u30e9\u3092\u4f5c\u308b\u3001\u304a\u305d\u3089\u304f\u6b63\u3057\u3044\u65b9\u6cd5 jessie\u7248 (motion + v4l2\u30c9\u30e9\u30a4\u30d0)<\/a>\u306b\u3088\u308b\u3068\u7d14\u6b63\u30ab\u30e1\u30e9\u3092motion\u3067\u4f7f\u3046\u306b\u306f\u30c9\u30e9\u30a4\u30d0\u3092\u5165\u308c\u308b\u5fc5\u8981\u304c\u3042\u308b\u3089\u3057\u3044\u306e\u3067\u5165\u308c\u3066\u304a\u304f<br \/>\n<strong>$ sudo service motion stop<\/strong><br \/>\n\u30c9\u30e9\u30a4\u30d0\u30fc\u3092\u9069\u7528<br \/>\n<strong>$ sudo modprobe bcm2835-v4l2<\/strong><br \/>\n<strong>$ sudo service motion start<\/strong><br \/>\n\u554f\u984c\u7121\u3055\u305d\u3046\u306a\u3089\u4e0b\u8a18\u3092\u8ffd\u8a18\u3057\u3066\u518d\u8d77\u52d5\u5f8c\u3082\u30c9\u30e9\u30a4\u30d0\u30fc\u3092\u6709\u52b9\u306b\u3059\u308b<br \/>\n<strong>$ sudo vi \/etc\/modules<\/strong><\/p>\n<pre><code>bcm2835-v4l2<\/code><\/pre>\n<p><strong>$ sudo reboot<\/strong><\/p>\n<p>\u30ea\u30ed\u30fc\u30c9\u3059\u308b\u3068\u30c9\u30e9\u30a4\u30d0\u30fc\u3082\u9069\u7528\u3055\u308c\u3066\u3044\u3066motion\u3082\u81ea\u52d5\u6a5f\u52d5\u3057\u3066\u3044\u3066\u3001\u3070\u3063\u3061\u308a\u9332\u753b\u3055\u308c\u3066\u3044\u3066\u753b\u8cea\u3082\u4ee5\u524d\u306eUSB\u30ab\u30e1\u30e9\u3060\u3068384*288\u304c\u9650\u754c\u3060\u3063\u305f\u306e\u3067\u6bd4\u3079\u308b\u3068\u304b\u306a\u308a\u9bae\u660e\u306b\u306a\u3063\u305f\u3002\uff08\u305f\u3060\u3001\u7d14\u6b63\u30ab\u30e1\u30e9\u3092\u4ed8\u3051\u308b\u3068VRAM\u304c128M\u306b\u5f37\u5236\u7684\u306b\u30a2\u30c3\u30d7\u3055\u308c\u308b\u306e\u3067\u30e1\u30e2\u30ea\u304c\u305d\u306e\u5206\u5360\u6709\u3055\u308c\u307e\u3059\uff09<\/p>\n<p>\u305f\u3060\u3001\u3053\u306e\u307e\u307e\u3060\u3068\u72af\u4eba\u304c\u30ab\u30e1\u30e9\u3092\u58ca\u3055\u308c\u308b\u3068\u30c7\u30fc\u30bf\u304c\u6d88\u3048\u308b\u306e\u3067\u8a3c\u62e0\u304c\u6b8b\u308b\u3088\u3046\u306b\u30c7\u30fc\u30bf\u3092\u3069\u3053\u304b\u306b\u4fdd\u5b58\u3055\u305b\u305f\u3044\u306e\u3067\u8272\u3005\u3068\u8a66\u3057\u3066\u307f\u305f\u3002<\/p>\n<p>\u3064\u3065\u304f\u30fb\u30fb\u30fb<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Raspberry Pi Camera Module V2\u3092\u30b2\u30c3\u30c8\u3057\u305f\u3002 \u6628\u4eca\u5b89\u4fa1\u3067\u9ad8\u6a5f\u80fd\u306a\u4e2d\u83ef\u88fd\u306eIP\u30ab\u30e1\u30e9\u304c\u3042\u308b\u304c\u4e0d\u5b89\u5b9a\u3067\u3059\u3050\u58ca\u308c\u308b\uff081\u5e74\u3050\u3089\u3044\u3067\u58ca\u308c\u305f\uff09\u3057\u4f55\u3088\u308a\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u7684\u306b\u602a\u3057\u3044\u306e\u3067\u6c17\u8efd\u306b\u306f\u4f7f\u3048\u306a\u3044\u3002\u305d\u3053\u3067Ra<\/p>\n","protected":false},"author":2,"featured_media":2316,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[206],"tags":[327,349],"class_list":["post-2323","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-diary","tag-raspberry-pi","tag-349"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/uda2.com\/blog\/wp-json\/wp\/v2\/posts\/2323","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/uda2.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/uda2.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/uda2.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/uda2.com\/blog\/wp-json\/wp\/v2\/comments?post=2323"}],"version-history":[{"count":9,"href":"https:\/\/uda2.com\/blog\/wp-json\/wp\/v2\/posts\/2323\/revisions"}],"predecessor-version":[{"id":2624,"href":"https:\/\/uda2.com\/blog\/wp-json\/wp\/v2\/posts\/2323\/revisions\/2624"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/uda2.com\/blog\/wp-json\/wp\/v2\/media\/2316"}],"wp:attachment":[{"href":"https:\/\/uda2.com\/blog\/wp-json\/wp\/v2\/media?parent=2323"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/uda2.com\/blog\/wp-json\/wp\/v2\/categories?post=2323"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/uda2.com\/blog\/wp-json\/wp\/v2\/tags?post=2323"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}