我一直在使用我的Raspberry Pi 2做一些运动检测使用USB摄像头和运动包,我感到难以置信的沮丧。
有人能向我解释一下on_motion_detected方法是如何工作的吗?。
这个想法是,当摄像机检测到运动时,就会执行一个脚本。为了测试目的,这个脚本只是几个单词而已。
视频流在我的本地网络上工作得很好,我可以看到将JPG和.avi文件写入目录的动作。
即使我尝试将我的脚本添加到电影start触发器中,nothing 也不会发生。
我尝试过的一些例子:
我还将脚本更改为不同的目录,推测出权限问题。还是什么都没发生。我已经尝试过移除;在方法之前,仍然什么也没有发生。我尝试过sudo,我尝试过作为脚本执行。拜托有人能帮帮我吗。我已经搜索了多年的线索,但在任何地方都找不到答案。
我的脚本没有被执行。
这个问题被问了1000次,没有人回答。我已经找了好几个小时了。
这里有几个线程已经被解说了:
https://unix.stackexchange.com/questions/59091/problems-running-python-script-from-motion https://www.raspberrypi.org/forums/viewtopic.php?t=86534&p=610482 https://raspberrypi.stackexchange.com/questions/8273/running-script-in-motion
发布于 2016-07-11 19:48:02
Ypu必须删除;这表示对行的注释
;on_motion_detected python /home/pi/Desktop/Python/script.py
但
on_motion_detected python /home/pi/Desktop/Python/script.py发布于 2018-05-15 07:26:22
如果您使用的是线程:warr1.conf,warb2.conf --尝试为它们编写脚本配置。我的线程:线程1.conf
videodevice /dev/video0
text_left USBWebcam-1
target_dir /samba/hdd/share/motion/usb
rotate 180
width 1024
height 768
#webcam_port 9081
#on_event_start /bin/bash /root/scripts/tg_msg.sh
on_picture_save /bin/bash /root/scripts/tg_msg.sh %f
#on_motion_detected /bin/bash /root/scripts/tg_msg.sh
#on_area_detected /bin/bash /root/scripts/tg_msg.sh
#on_movie_start /bin/bash /root/scripts/tg_msg.sh和线程2.conf:
text_left Foscam IP
netcam_url http://192.168.111.7:8080/video
target_dir /samba/hdd/share/motion/ip
width 1024
height 768
#on_event_start /bin/bash /root/scripts/tg_msg.sh
on_picture_save /bin/bash /root/scripts/tg_msg.sh %f
#on_motion_detected /bin/bash /root/scripts/tg_msg.sh
#on_area_detected /bin/bash /root/scripts/tg_msg.sh
#on_movie_start /bin/bash /root/scripts/tg_msg.sh发布于 2022-03-03 23:43:25
我有一个简单的解决方案,但需要有人解释这是如何工作的。从根部开始运动。添加一行到/etc/rc.local 'sudo运动‘重新引导,大多数事件将工作,如果启动为根,on_event_end sudo ...command或脚本.
https://stackoverflow.com/questions/35469118
复制相似问题