motioneye-project / motioneyeos

A Video Surveillance OS For Single-board Computers
Other
7.79k stars 891 forks source link

Motion not recording Debian 9 and other bugs #2272

Open ghost opened 4 years ago

ghost commented 4 years ago

I have followed the official guide to install it on Debian. https://github.com/ccrisan/motioneye/wiki/Install-On-Debian

Version I using is the latest 0.42 what pip pulls down.

First issue is the process cannot be restarted because the pid gets created with wrong permission 666.

/init.d/motioneye {start|stop|restart|status}
root@meye:/etc/motioneye# /etc/init.d/motioneye stop
[....] Stopping motionEye server:start-stop-daemon: matching on world-writable pidfile /var/run/motioneye.pid is insecure
 failed!
root@meye:/etc/motioneye# ps aux | grep moti
root     20433  3.5  0.6 283592 24736 ?        Sl   09:41   0:46 /usr/bin/python /usr/local/bin/meyectl startserver -c /etc/motioneye/motioneye.conf -l -b
root     20460  0.0  0.4  60788 18180 ?        S    09:41   0:00 /usr/bin/python /usr/local/bin/meyectl startserver -c /etc/motioneye/motioneye.conf -l -b
root     24102  0.0  0.0   3080   824 pts/0    S+   10:03   0:00 grep moti

This can be easily fixed by modifying the startup script:

    start)
        log_daemon_msg "Starting $DESC"
        if start-stop-daemon --start --oknodo --exec $DAEMON --chuid $USER -- $OPTIONS; then
            log_end_msg 0
        else
            log_end_msg 1
            RET=1
        fi
    chmod 600 $PIDFILE
        ;;

My second issue that no videos created. Since meye running as root and the directories exist. I have tried to restart the service multiple time, reenable movies multiple times, trying to change the codecs, nothing gets created. I also put it into continuous recording while playing with this which is indicated by red frame around the video. So it should record but it does nothing. FFMPEG is installed:

ii ffmpeg 7:4.1.4-1~deb10u1 amd64 Tools for transcoding, streaming and playing of multimedia files

Here is a camera config for example:

# @username admin
# @enabled on
# @proto motioneye
# @remote_camera_id 1
# @port 
# @host 10.1.0.10
# @path /
# @scheme http
# @id 1
# @password removed

I see no useful info regarding to this in /var/log/motioneye.log.

ghost commented 4 years ago

Actually I have realized what is going on: If you add a camera as remote motion eye camera that will never be saved locally and anything you change on either motions server will be the same on the other side. It seems there is no way in motioneye to be able to cascade the servers the way I thought this would work.

The current setup is

camera1 camera2 --- Site A --- Central site camera3

In this case Site A stores the recordings only. What I would like to accomplish is that the recordings are also stored on the Central side without rsync or other tools but only the recordings. Even if with the current setup I would rsync them from site A, every time you play a video from the Central site it will connect back to site A to fetch that video. Also from security perspective this is broken. If site A is compromised you have no clue what was going on.

As a possible solution I have discovered that motioneye can not just aggregate but restream on another port however when adding the restreamed motion-eye cameras to the Central site as regular "Network Cameras" all I get is gray area and no stream, while in the browser they are perfectly reachable.

This tunnel through solution between motion eyes to get files are seriously not good because the bandwidth between the 2 locations can be low. So for example your Central site is on 10Gbit link while Site A is on a 10mbit ADSL. If someone want to watch a video from the Central it's almost instant download while the remote motion eyes registered on the central site could take half an hour to pull that video from site A.