{"id":287,"date":"2024-03-11T12:59:41","date_gmt":"2024-03-11T04:59:41","guid":{"rendered":"https:\/\/lab.libra.tw\/?p=287"},"modified":"2024-03-11T13:22:38","modified_gmt":"2024-03-11T05:22:38","slug":"%e7%87%95%e5%ad%90%e7%9b%a3%e8%a6%96%e5%99%a8-esp32-cam-motion","status":"publish","type":"post","link":"https:\/\/lab.libra.tw\/?p=287","title":{"rendered":"\u71d5\u5b50\u76e3\u8996\u5668    &#8212;  ESP32 CAM + Motion"},"content":{"rendered":"\n<p><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-cyan-bluish-gray-color\">\u9019\u7bc7\u5beb\u4e86\u5927\u534a\u5e74\uff0c\u5f9e2023\u5e74\u4e2d\u5beb\u52302024 XD<\/mark><\/p>\n\n\n\n<p>2022\u7684\u71d5\u5b50\uff0c\u5de2\u505a\u5230\u4e00\u534a\uff0c\u5c31\u6c92\u518d\u56de\u4f86\u4e86\uff0c\u5de2\u5c31\u88ab\u9577\u671f\u8eb2\u5728\u5bb6\u88e1\u914d\u96fb\u5b54\u88e1\u7684\u9ebb\u96c0\u4f54\u8d70\uff0c<br>\u53ea\u662f\u9ebb\u96c0\u4f3c\u4e4e\u4e5f\u4e0d\u6703\u7bc9\u5de2\uff0c\u5de2\u5c31\u4e00\u5929\u4e00\u5929\u7684\u525d\u843d\uff0c\u6700\u5c31\u6574\u500b\u6389\u4e0b\u4f86\uff0c<br>2023\u6625\u5929\uff0c\u767c\u73fe\u71d5\u5b50\u53c8\u4f86\u5bb6\u88e1\u7bc9\u5de2\uff0c\u6240\u4ee5\u8d95\u7dca\u555f\u52d5\u53bb\u5e74\u9810\u8a08\u8981\u505a\u7684\u71d5\u5b50\u76e3\u8996\u5668\uff0c<br>\u8a18\u9304\u4e00\u4e0b\u4f86\u5bb6\u88e1\u505a\u5ba2\u7684\u71d5\u5b50\u3002<\/p>\n\n\n\n<p>\u71d5\u5b50\u76e3\u8996\u5668\u7684\u91cd\u9ede\u6709\u5e7e\u500b\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4f4e\u6210\u672c<\/li>\n\n\n\n<li>\u7121\u7dda\u50b3\u8f38<\/li>\n\n\n\n<li>\u5177\u52d5\u614b\u5075\u6e2c<\/li>\n\n\n\n<li>\u53ef\u9577\u6642\u9593\u8a18\u9304<\/li>\n<\/ul>\n\n\n\n<p>ESP32 CAM\u53ef\u4ee5\u9054\u5230\u4f4e\u6210\u672c\u548c\u7121\u7dda\u50b3\u8f38\u7684\u8981\u6c42\uff0c\u4f46\u8981\u52d5\u614b\u5075\u6e2c\u548c\u9577\u6642\u9593\u8a18\u9304\uff0c\u5c31\u9700\u8981\u4e00\u53f0\u96fb\u8166\u4e3b\u6a5f\u7684\u914d\u5408\u3002<\/p>\n\n\n\n<p>\u5229\u7528\u5148\u524d\u67b6\u597d\u7684\u5c0f\u4f3a\u670d\u5668\uff0c\u88dd\u4e0a<a href=\"https:\/\/motion-project.github.io\/index.html\">Motion<\/a>\u9019\u500b\u5957\u4ef6\uff0c\u9019\u5957\u4ef6\u4e3b\u8981\u7684\u529f\u80fd\u6709(\u4ee5\u4e0b\u7ffb\u81ea\u5b98\u7db2)\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5728\u5075\u6e2c\u5230\u52d5\u4f5c\u6642\uff0c\u5efa\u7acb\u5f71\u7247\u6216\u662f\u5132\u5b58\u7167\u7247<\/li>\n\n\n\n<li>\u76f4\u63a5\u9304\u88fd\u591a\u53f0IP Cam\u7684\u5f71\u50cf<\/li>\n\n\n\n<li>\u651d\u5f71\u6a5f\u5373\u6642\u5f71\u50cf\u4e32\u6d41\u76f4\u64ad<\/li>\n\n\n\n<li>\u89f8\u767c\u52d5\u4f5c\u6642\u547c\u53ebscript\u7a0b\u5f0f<\/li>\n\n\n\n<li>\u6d3b\u52d5\u8a18\u9304\u5230\u5404\u7a2e\u8cc7\u6599\u5eab<\/li>\n\n\n\n<li>\u53ef\u91dd\u5c0d\u96b1\u79c1\u6216\u52d5\u614b\u5075\u6e2c\u9700\u6c42\uff0c\u5b8c\u5168\u5ba2\u5236\u5316\u906e\u7f69<\/li>\n\n\n\n<li>Webcam control\u548c\u4e32\u6d41\u5b8c\u5168\u652f\u63f4\u6709\u8a8d\u8a3c\u7684t ls (https)<\/li>\n<\/ul>\n\n\n\n<p>\u53ef\u642d\u914d\u5404\u7a2e\u985e\u578b\u7684\u8a2d\u5099<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u7db2\u8def\u651d\u5f71\u6a5f(RTSP, RTMP, HTTP)<\/li>\n\n\n\n<li>PI camera(\u6a39\u8393\u6d3e\u651d\u5f71\u6a5f)<\/li>\n\n\n\n<li>V4L2 webcams<\/li>\n\n\n\n<li>\u5f71\u50cf\u64f7\u53d6\u5361<\/li>\n\n\n\n<li>\u73fe\u6709\u7684\u5f71\u50cf\u6a94<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">ESP32 CAM\u76f8\u95dc\u8a2d\u5b9a<\/h2>\n\n\n\n<p>ESP32 CAM\u4ecb\u7d39\u8207\u6559\u5b78\uff0c\u7db2\u8def\u53cayoutube\u4e0a\u5df2\u6709\u76f8\u7576\u591a\u7684\u6559\u5b78\uff0c\u9019\u908a\u53ea\u5c31\u8a2d\u5b9a\u90e8\u4efd\u53ca\u6ce8\u610f\u4e8b\u9805\u52a0\u4ee5\u8aaa\u660e\u3002<\/p>\n\n\n\n<p>\u67b6\u597dESP32 CAM\uff0c\u555f\u52d5\u5f8c\uff0c\u5728\u96fb\u8166\u7684\u700f\u89bd\u5668\u4e0a\u6253\u5165ESP32 CAM\u7684ip\uff0c\u5c31\u53ef\u4ee5\u9032\u5165\u5230\u8a58\u5b9a\u9801\u9762\uff0c<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"383\" height=\"893\" src=\"https:\/\/lab.libra.tw\/wp-content\/uploads\/2023\/06\/esp32_setting.png\" alt=\"\" class=\"wp-image-295\" srcset=\"https:\/\/lab.libra.tw\/wp-content\/uploads\/2023\/06\/esp32_setting.png 383w, https:\/\/lab.libra.tw\/wp-content\/uploads\/2023\/06\/esp32_setting-129x300.png 129w\" sizes=\"auto, (max-width: 383px) 100vw, 383px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Resolution\u8a2d\u5b9a\u6703\u5f71\u97ff\u5230Motion\uff0c\u56e0\u6b64\u5148\u9078\u5b9a\u4f60\u8981\u7684\u89e3\u6790\u5ea6\uff0c\u89e3\u6790\u5ea6\u6108\u9ad8\uff0c\u5f71\u50cf\u6a94\u4e5f\u6108\u5927<\/li>\n\n\n\n<li>Quality\u90e8\u4efd\uff0c\u6578\u503c\u6108\u5c0f\uff0c\u5f71\u50cf\u6108\u6e05\u6670<\/li>\n<\/ul>\n\n\n\n<p>\u5176\u4ed6\u8a2d\u5b9a\u53ef\u81ea\u884c\u4f9d\u559c\u597d\u8a2d\u5b9a\uff0c\u5f71\u50cf\u89e3\u6790\u5ea6\u6108\u5927\uff0c\u6108\u6e05\u6670\uff0c\u5f71\u50cf\u6a94\u6108\u5927\uff0c\u5f8c\u7aef\u8655\u7406\u7684\u96fb\u8166\u8981\u6c42\u4e5f\u6703\u6108\u9ad8\uff0c\u9019\u90e8\u4efd\u9700\u8981\u4f9d\u81ea\u5df1\u7684\u786c\u9ad4\u53bb\u8abf\u6574\uff1bESP32 CAM\u540c\u6642\u53ea\u80fd\u63a5\u53d7\u4e00\u500b\u5f71\u8c61\u4e32\u6d41\uff0c\u5728\u8a2d\u5b9a\u756b\u9762\u4e32\u6d41\u6642\uff0cMotion\u5373\u7121\u6cd5\u53d6\u5f97\u4e32\u6d41\u5f71\u50cf\uff0c\u53cd\u904e\u4f86\u4e5f\u662f\uff0c\u6b64\u90e8\u4efd\u9700\u6ce8\u610f\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Motion\u5b89\u88dd<\/h2>\n\n\n\n<p>\u5f8c\u7aef\u96fb\u8166\u662f\u4f7f\u7528\u67b6\u5728Proxmox\u4e0a\u7684Ubuntu Server VM\uff0c\u5b89\u88ddMotion\u7684\u65b9\u5f0f\u53ef\u4ee5\u7528apt\u7684\u65b9\u5f0f\u5b89\u88dd\uff0c\u4f7f\u7528\u4ee5\u4e0b\u6307\u4ee4<\/p>\n\n\n\n<p><strong>sudo apt-iget install motion<\/strong><\/p>\n\n\n\n<p>\u9019\u7a2e\u5b89\u88dd\u65b9\u5f0f\u8f03\u7c21\u55ae\uff0cMotion\u7248\u672c\u53ef\u80fd\u8f03\u820a\uff0c\u4f46\u7a69\u5b9a\u3001\u975e\u5e38\u65b9\u4fbf\u3002\u56e0\u6211\u9084\u5728\u719f\u6089\u53ca\u5b78\u7fd2Linux\uff0c\u56e0\u6b64\u9078\u64c7\u81ea\u884c\u7de8\u8b6f\uff0c\u4e00\u6b65\u4e00\u6b65\u5b8c\u6210\uff0c\u53c3\u8003<a href=\"https:\/\/motion-project.github.io\/motion_build.html#Make\" target=\"_blank\" rel=\"noreferrer noopener\">\u5b98\u7db2\u6559\u5b78<\/a>\uff0c\u627e\u5230Abbreviate Building GUide\uff0cDebian \/ Ubuntu \/Raspbian packages\uff08\u4f9d\u81ea\u5df2\u4f7f\u7528\u7684\u4f5c\u696d\u7cfb\u7d71\u9078\u64c7\u5b89\u88dd\u7684\u8aaa\u660e\uff09\uff0c\u5148\u5b89\u88dd\u5fc5\u8981\u5957\u4ef6\uff0c<\/p>\n\n\n\n<p><code><strong>udo apt-get install autoconf automake autopoint build-essential pkgconf libtool libzip-dev libjpeg-dev git libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libavdevice-dev libwebp-dev gettext libmicrohttpd-dev<\/strong><\/code><\/p>\n\n\n\n<p>\u53e6\u5916\u53ef\u4f9d\u81ea\u5df2\u9700\u6c42\uff0c\u518d\u5b89\u88dd\u5176\u4ed6\u5957\u4ef6\uff0c\u5efa\u8b70FFMpeg\u5957\u4ef6\uff08\u5f71\u50cf\u6a94\u88fd\u4f5c\u3001\u4f7f\u7528\u7db2\u8def\u651d\u5f71\u6a5f\uff09\u4e00\u4f75\u5b89\u88dd<\/p>\n\n\n\n<p><code><strong>sudo apt-get install libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libavdevice-dev<\/strong><\/code><\/p>\n\n\n\n<p>cd\u5230\u6839\u76ee\u9304\uff0c\u81eagithub\u4e0a\u4e0b\u8f09Motion\u5957\u4ef6\uff0c\u9810\u8a2d\u662f\u7576\u6642\u6700\u65b0\u7248\u677f\u672c<\/p>\n\n\n\n<p><code><strong>cd ~<\/strong><\/code><br><code><strong>git clone https:\/\/github.com\/Motion-Project\/motion.git<\/strong><\/code><\/p>\n\n\n\n<p>cd\u5230Motion\u76ee\u9304\uff0c\u88fd\u4f5c.configure\u6a94\uff0c\u4e4b\u5f8c\u9032\u884cmake\u7de8\u8b6f\uff0cmake\u6642\u9593\u4f9dcpu\u6548\u80fd\u4e0d\u540c\uff0c\u53ef\u80fd\u6703\u82b1\u4e00\u9ede\u6642\u9593\uff0c<\/p>\n\n\n\n<p><code><strong>cd motion<\/strong><\/code><br><code><strong>autoreconf -fiv<\/strong><\/code><br><code><strong>.\/configure<\/strong><\/code><br><code><strong>make<\/strong><\/code><\/p>\n\n\n\n<p>\u5b89\u88dd\u7de8\u8b6f\u597d\u7684\u5957\u4ef6<\/p>\n\n\n\n<p><code><strong>make install<\/strong><\/code><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u7de8\u8f2fmotion.conf\u6a94<\/h2>\n\n\n\n<p>conig\u6a94\u4f4d\u7f6e\u5728<\/p>\n\n\n\n<p><strong>\/usr\/local\/etc\/motion<\/strong><\/p>\n\n\n\n<p>\u9996\u5148\u7de8\u8f2fmotion.conf\uff0c\u53ef\u4ee5\u7528vi\u6216nano\u7de8\u8f2f<\/p>\n\n\n\n<p>\u5e7e\u500b\u8981\u6ce8\u610f\u7684\u5730\u65b9\u5982\u4e0b\uff1a<\/p>\n\n\n\n<p><strong>\u8a2d\u5b9amotion\u80cc\u666f\u555f\u52d5<\/strong><br>#Start in daemon (background) mode and release terminal.<br>daemon on<\/p>\n\n\n\n<p><strong>\u8a2d\u5b9amotion\u622a\u53d6\u7684\u5716\u7247\u3001\u5f71\u7247\u7684\u5b58\u653e\u76ee\u9304\uff0c\u5fc5\u9808\u624b\u52d5\u5efa\u7acb\uff0c\u70ba\u958b\u555f\u5b58\u53d6\u6b0a\u9650\uff0c\u9019\u908a\u5047\u8a2d\u662f\u5728&#8221;<\/strong>\/motion_pic&#8221;<br>#Target directory for pictures, snapshots and movies<br>target_dir \/motion_pic<\/p>\n\n\n\n<p><strong>\u7121\u5075\u6e2c\u5230\u52d5\u4f5c\u4ecd\u6301\u7e8c\u622a\u53d6\u5716\u7247\u3001\u5f71\u7247\uff0c\u8a2d\u5b9a\u70baoff<\/strong><br>Always save pictures and movies even if there was no motion.<br>emulate_motion off<br><br><strong>\u5075\u6e2c\u5230\u52d5\u4f5c\u4e4b\u5224\u5b9a\u53ca\u622a\u53d6\u5f71\u7247\u76f8\u95dc\u8a2d\u5b9a\uff0c\u4ee5\u4e0a\u63d0\u4f9b\u53c3\u8003\uff0c\u53ef\u81ea\u884c\u6e2c\u8a66\u8abf\u6574<\/strong><br>#Threshold for number of changed pixels that triggers motion.<br>threshold 1500<br><br>#Noise threshold for the motion detection.<br>noise_level 32<br><br>#Despeckle the image using (E\/e)rode or (D\/d)ilate or (l)abel.<br>despeckle_filter EedDl<br><br>#Number of images that must contain motion to trigger an event.<br>minimum_motion_frames 1<br><br>#Gap in seconds of no motion detected that triggers the end of an event.<br>event_gap 30<br><br>#The number of pre-captured (buffered) pictures from before motion.<br>pre_capture 30<br><br>#Number of frames to capture after motion is no longer detected.<br>post_capture 245<br><br>#Output pictures when motion is detected<br>picture_output off<br><br>#Create movies of motion events.<br>movie_output on<br><br>#The encoding quality of the movie. (0=use bitrate. 1=worst quality, 100=best)<br>movie_quality 45<br><br>#Container\/Codec to used for the movie. See motion_guide.html<br>movie_codec hevc<br>movie_duplicate_frames on<br><br><strong>Webcontrol\u53caStream<\/strong>\u8a2d\u5b9a<br>#Restrict webcontrol connections to the localhost.<br>webcontrol_localhost on<br><br>#The port number for the live stream.<br>stream_port 8081<br><br>#Restrict stream connections to the localhost.<br>stream_localhost off<br><br><strong>Camera config\u6a94\u8def\u5f91\u8a2d\u5b9a\uff0c\u7531\u65bc\u4e4b\u5f8c\u53ef\u80fd\u6703\u7528\u591a\u53f0ESP CAM\uff0c\u56e0\u6b64\u5c07Camera config\u7368\u7acb\u8a2d\u5b9a<\/strong><br>#Directory to read &#8216;.conf&#8217; files for cameras.<br>camera_dir \/usr\/local\/etc\/motion\/conf.d<br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u7de8\u8f2fCamera config\u6a94\u8a2d\u5b9a<\/strong><\/h2>\n\n\n\n<p><br>copy\u7bc4\u5217\u6a94camera1.dist.conf\u81f3\u4e0a\u5217camera config\u8a2d\u5b9a\u6a94\u5b58\u653e\u76ee\u9304\uff0c\u5c07\u6a94\u540d\u6539\u70bacamera1\uff0c\u4e26\u7de8\u8f2f<br>#User defined name for the camera.   (\u651d\u5f71\u6a5f\u540d\u7a31)<br>camera_name ESP32-CAM<br><br>#Numeric identifier for the camera.  (\u651d\u5f71\u6a5fid) <br>camera_id 101<br><br><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">#The full URL of the network camera stream.<\/mark>  (\u8a2d\u5b9aESP32\u4e32\u6d41\u8def\u7db2\u5740\uff0c\u9810\u8a2d\u662f&#8221;http:\/\/ip<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">:81\/stream<\/mark>&#8220;<br>netcam_url http:\/\/192.168.1.10:81\/stream<br><br>#Image width in pixels  (\u622a\u53d6\u5f71\u50cf\u5bec)<br>width 1024<br><br>#Image height in pixels.  (\u622a\u53d6\u5f71\u50cf\u9577)<br>height 768<br><br>\u622a\u53d6\u5f71\u50cf\u5728\u756b\u9762\u4e0a\u7684\u6d6e\u6c34\u5370\u6587\u5b57\u8a2d\u5b9a\uff0c\u4f9d\u81ea\u5df1\u9700\u8981\u8a2d\u5b9a<br>#Text to be overlayed in the lower left corner of images<br>text_left ESP32<br><br>#Text to be overlayed in the lower right corner of images.<br>text_right ESP32-CAM\\n%Y-%m-%d\\n%T-%q<br><br>#File name(without extension) for movies relative to target directory<br>movie_filename ESP_CAM_%t-%v-%Y%m%d%H%M%S<br><br><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">\u4e32\u6d41\u700f\u89bd\u6b0a\u9650\u8a2d\u5b9a<\/mark><br><strong>motion\u76f4\u64ad\u4e32\u6d41\u7db2\u5740&#8221;http:\/\/ip:8081\/101\/&#8221;<br>ip\u662fmotion\u4e3b\u6a5fip\uff0cport\u4f9dmotion.conf\u8a2d\u5b9a\u7684stream port, 101\u662fcamera id<\/strong><br>\u958b\u555f\u9a57\u8b49\u8a2d\u5b9a\uff0c\u907f\u514d\u4ed6\u4eba\u53ef\u4e0d\u7d93\u8a31\u53ef\u5373\u53ef\u700f\u89bd\uff0c<br>\u9700\u5c07\u4e0b\u5217stream_authentication\u7684id\u8207password\u6539\u70ba\u60a8\u7684\u8a2d\u5b9a<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"><br>stream_auth_method 1<br>stream_authentication id:password<\/mark><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u555f\u52d5motion,\u8a2d\u5b9amotion\u70ba\u670d\u52d9<\/h2>\n\n\n\n<p>\u5982\u4ee5apt install\u65b9\u5f0f\u5b89\u88ddmotion\uff0c\u9810\u8a2d\u5373\u53ef\u4ee5\u7528sudo systemctl start motion\u7684\u65b9\u5f0f\u555f\u52d5motion\uff0c<br>\u81ea\u884c\u5b89\u88dd\u7684\u8a71\uff0c\u5728\/etc\/init.d\u65b0\u589e&#8221;motion&#8221;\u6a94\u6848\uff0c\u52a0\u5165\u4ee5\u4e0b\u5167\u5bb9<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/sh -e\n#\n# \/etc\/init.d\/motion: Start the motion detection\n#\n### BEGIN INIT INFO\n# Provides:\t  motion\n# Required-Start: $local_fs $syslog $remote_fs\n# Required-Stop: $remote_fs\n# Default-Start:  2 3 4 5\n# Default-Stop: 0 1 6\n# Short-Description: Start Motion detection\n# Description: loads motion and assigns privileges\n### END INIT INFO\n\n# Ported to new debian way using sh and \/lib\/lsb\/init-functions\n# by Angel Carpintero &lt;ack@telefonica.net&gt;\n# Modified by : Juan Angulo Moreno &lt;juan@apuntale.com&gt;\n#               Eddy Petrisor &lt;eddy.petrisor@gmail.com&gt;\n#               ArAge &lt;ArAge@gmx.co.uk&gt;\nNAME=motion\nPATH_BIN=\/bin:\/usr\/bin:\/sbin:\/usr\/sbin\nDAEMON=\/usr\/local\/bin\/motion\nDEFAULTS=\/etc\/default\/$NAME\nDESC=\"motion detection daemon\"\n\nENV=\"env -i LANG=C PATH=$PATH_BIN\"\n\n. \/lib\/lsb\/init-functions\n\ntest -x $DAEMON || exit 0\n\nRET=0\n\n&#91; -r \"$DEFAULTS\" ] &amp;&amp; . \"$DEFAULTS\" || start_motion_daemon=yes\n\n\ncheck_daemon_enabled () {\n    if &#91; \"$start_motion_daemon\" = \"yes\" ] ; then\n        return 0\n    else\n        log_warning_msg \"Not starting $NAME daemon, disabled via \/etc\/default\/$NAME\"\n        return 1\nNAME=motion\nPATH_BIN=\/bin:\/usr\/bin:\/sbin:\/usr\/sbin\nDAEMON=\/usr\/local\/bin\/motion\nDEFAULTS=\/etc\/default\/$NAME\nDESC=\"motion detection daemon\"\n\nENV=\"env -i LANG=C PATH=$PATH_BIN\"\n\n. \/lib\/lsb\/init-functions\n\ntest -x $DAEMON || exit 0\n\nRET=0\n\n&#91; -r \"$DEFAULTS\" ] &amp;&amp; . \"$DEFAULTS\" || start_motion_daemon=yes\n\n\ncheck_daemon_enabled () {\n    if &#91; \"$start_motion_daemon\" = \"yes\" ] ; then\n        return 0\n    else\n        log_warning_msg \"Not starting $NAME daemon, disabled via \/etc\/default\/$NAME\"\n        return 1\n    fi\n\n}\n\n\ncase \"$1\" in\n  start)\n    if check_daemon_enabled ; then\n        if ! &#91; -d \/var\/run\/motion ]; then\n            mkdir -m 02750 \/var\/run\/motion\n            chown motion:motion \/var\/run\/motion\n        fi\n        if ! &#91; -d \/var\/lib\/motion ]; then\n            mkdir -m 02750 \/var\/lib\/motion\n            chown motion:adm \/var\/lib\/motion\n        fi\n        if ! &#91; -d \/var\/log\/motion ]; then\n            mkdir -m 02750 \/var\/log\/motion\n            chown motion:adm \/var\/log\/motion\n        fi\n        log_daemon_msg \"Starting $DESC\" \"$NAME\"\n        if start-stop-daemon --start --oknodo --exec $DAEMON -b --chuid motion ; then\n            log_end_msg 0\n        else\n            log_end_msg 1\n            RET=1\n        fi\n    fi\n    ;;\n\n  stop)\n    log_daemon_msg \"Stopping $DESC\" \"$NAME\"\n    if start-stop-daemon --stop --oknodo --exec $DAEMON --retry 30 ; then\n        log_end_msg 0\n    else\n        log_end_msg 1\n        RET=1\n    fi\n    ;;\n\n  reload|force-reload)\n    log_daemon_msg \"Reloading $NAME configuration\"\n    if start-stop-daemon --stop --signal HUP --exec $DAEMON ; then\n        log_end_msg 0\n    else\n        log_end_msg 1\n        RET=1\n    fi\n    ;;\n\n  restart-motion)\n    if check_daemon_enabled ; then\n        log_action_begin_msg \"Restarting $NAME\"\n        if $0 stop &amp;&amp; $0 start ; then\n            log_action_end_msg 0\n        else\n            log_action_cont_msg \"(failed)\"\n            RET=1\n        fi\n    fi\n    ;;\n\n  restart)\n    $0 restart-motion\n    ;;\n\n  status)\n    status_of_proc \/usr\/local\/bin\/motion motion\n    ;;\n\n  *)\n    echo \"Usage: \/etc\/init.d\/$NAME {start|stop|restart|reload|status}\"\n    RET=1\n    ;;\nesac\n\n\nexit $RET<\/code><\/pre>\n\n\n\n<p>\u57f7\u884c<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl daemon-reload<\/code><\/pre>\n\n\n\n<p>\u4e4b\u5f8c\u53ef\u4ee5\u555f\u52d5motion<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl start motion<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u5176\u4ed6<\/h2>\n\n\n\n<p>\u5728\u76e3\u8996\u5668\u5b8c\u6210\u6c92\u591a\u4e45\uff0c\u71d5\u5b50\u4e5f\u52a0\u7dca\u8173\u6b65\u628a\u5de2\u5b8c\u6210\uff0c\u63a5\u4e0b\u4f86\u5c31\u4e0b\u86cb\uff0c\u5176\u4e2d\u4e00\u96bb\u71d5\u5b50\u5e7e\u4e4e\u90fd\u7559\u5728\u5de2\u88e1\u5b75\u86cb\uff0c\u53ea\u662f\u4e09\u9031\u5f8c\uff0c\u5c0f\u71d5\u5b50\u51fa\u4f86\u4e86\uff0c \u6709\u5929\u508d\u665a\uff0c\u71d5\u5b50\u5de2\u908a\u7e5e\u98db\uff0c\u4e00\u908a\u53eb\uff0c\u5c31\u50cf\u5e73\u5e38\u9ebb\u96c0\uff08\u6216\u662f\u6211 \uff09\u9760\u8fd1\u5de2\u7684\u6642\u5019\uff0c\u53ea\u662f\u67e5\u770b\u6642\uff0c\u6c92\u770b\u5230\u4ec0\u587a\uff0c\u9694\u5929\u71d5\u5b50\u5c31\u6c92\u518d\u56de\u4f86\uff0c\u5f8c\u4f86\u4ed4\u7d30\u770b\u5de2\u908a\u6709\u9ed1\u8272\u5c0f\u9ede\uff0c\u5bc6\u5bc6\u9ebb\u9ebb\u7684\uff0c\u662f\u879e\u87fb\uff0c\u624d\u9a5a\u89ba\u5de2\u5167\u9db5\u5df2\u7d93\u6b7b\u4e86\uff0c\u53ef\u60dc\u7121\u6cd5\u8a18\u9304\u5230\u5b8c\u6574\u80b2\u9db5\u7684\u904e\u7a0b\u3002<\/p>\n\n\n\n<p>2024\u5e74\uff0c\u518d\u91cd\u65b0\u628a\u76e3\u8996\u5668\u67b6\u8d77\u4f86\uff0c\u70ba\u4e86\u6539\u5584\u904e\u71b1\u554f\u984c\uff0c\u91cd\u5370ESP32 CAM\u7684\u5916\u6bbc\uff0c\u5e0c\u671b\u4eca\u5e74\u71d5\u5b50\u80fd\u518d\u4f86\u7bc9\u5de2\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u4e0b\u9762\u662f2023\u5e74\u9304\u5230\u7684\u4e00\u4e9b\u756b\u9762\uff0c\u71d5\u5b50\u96e2\u958b\u5f8c\uff0c\u5de2\u5c31\u88ab\u9ebb\u96c0\u4f54\u8d70\u4e86XD<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"720\" style=\"aspect-ratio: 1280 \/ 720;\" width=\"1280\" controls src=\"https:\/\/lab.libra.tw\/wp-content\/uploads\/2024\/03\/ESP_CAM_101-170-20230412121251.mp4\"><\/video><\/figure>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"720\" style=\"aspect-ratio: 1280 \/ 720;\" width=\"1280\" controls src=\"https:\/\/lab.libra.tw\/wp-content\/uploads\/2024\/03\/ESP_CAM_101-13-20230526195448.mp4\"><\/video><\/figure>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"720\" style=\"aspect-ratio: 1280 \/ 720;\" width=\"1280\" controls src=\"https:\/\/lab.libra.tw\/wp-content\/uploads\/2024\/03\/ESP_CAM_101-38-20230531011545.mp4\"><\/video><figcaption class=\"wp-element-caption\">ESP_CAM_101-38-20230531011545<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u9019\u7bc7\u5beb\u4e86\u5927\u534a\u5e74\uff0c\u5f9e2023\u5e74\u4e2d\u5beb\u52302024 XD 2022\u7684\u71d5\u5b50\uff0c\u5de2\u505a\u5230\u4e00\u534a\uff0c\u5c31\u6c92\u518d\u56de\u4f86\u4e86\uff0c\u5de2\u5c31\u88ab\u9577 &hellip; <\/p>\n","protected":false},"author":1,"featured_media":373,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20,9],"tags":[22,28],"class_list":["post-287","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-esp32","category-9","tag-esp32","tag-motion"],"_links":{"self":[{"href":"https:\/\/lab.libra.tw\/index.php?rest_route=\/wp\/v2\/posts\/287","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lab.libra.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lab.libra.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lab.libra.tw\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lab.libra.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=287"}],"version-history":[{"count":4,"href":"https:\/\/lab.libra.tw\/index.php?rest_route=\/wp\/v2\/posts\/287\/revisions"}],"predecessor-version":[{"id":372,"href":"https:\/\/lab.libra.tw\/index.php?rest_route=\/wp\/v2\/posts\/287\/revisions\/372"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lab.libra.tw\/index.php?rest_route=\/wp\/v2\/media\/373"}],"wp:attachment":[{"href":"https:\/\/lab.libra.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=287"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lab.libra.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=287"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lab.libra.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=287"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}