Motioneye: Difference between revisions

From 太極
Jump to navigation Jump to search
Line 141: Line 141:
== Motion trigger ==
== Motion trigger ==
* Threshold and mask. [https://github.com/ccrisan/motioneyeos/issues/695 Hard to set up the motion trigger. #695]
* Threshold and mask. [https://github.com/ccrisan/motioneyeos/issues/695 Hard to set up the motion trigger. #695]
* '''Pi zero'''. Motion trigger function on Pi zero is not stable even I set frame change threshold 0.1%. Ssh to Pi zero shows the CPU usage is consistently high (> 90%). Even "continuous recording" is not stable on Pi zero. This leaves only the streaming and interval snapshots for "still images" option for pi zero.
* '''Pi zero'''. Motion trigger function on Pi zero is not stable even I set frame change threshold 0.1%. Ssh to Pi zero shows the CPU usage is consistently high (> 90%). Even "continuous recording" is not stable on Pi zero. This leaves only the '''streaming''' and interval snapshots for '''still images''' option for pi zero.
** There is a '''timelapse''' button under the "Open Picture Browser" window. The created timelapse video is in a avi format and downloaded automatically (check browser's setting if the download is blocked). Works fine on Pi zero.
** '''Still images'''. Capture mode: Motion trigger, Motion trigger (one picture), Interval snapshots, All frames, Manual.
** There is a '''timelapse''' button under the "Open Picture Browser" window. The created timelapse video is in a avi format and downloaded automatically (check browser's setting if the download is blocked). Works fine on Pi zero. We change change the "snapshot interval" in seconds and increase the resolution.
* '''4:3''' aspect ratio:
** 800x600
** 1024x768
** 1280x960
** 1440x1080
** 1600*1200: 171 KB for a picture (or .6 GB per hour)
* '''16:9''' aspect ratio
* Table of actually frame rate depending on the resolution and target frame rate from my experiment (HW: Pi2):
* Table of actually frame rate depending on the resolution and target frame rate from my experiment (HW: Pi2):
::{| class="wikitable"
::{| class="wikitable"

Revision as of 12:33, 16 July 2020

Motion software

motionEye

motionEyeOS

  • Summary of the setup (for some reason, the static ip does not work so a different way to find the IP is needed)
    • touch ssh
    • cp ~/Downloads/static_ip.conf . (optional)
    • cp ~/Downloads/wpa_supplicant.conf .
    • nano static_ip.conf (optional)
      static_ip="192.168.1.14/24"
      static_gw="192.168.1.1"
      static_dns="8.8.8.8"
      
    • If I hook rpi zero w to an HDMI cable, I see starting wpa_supplicant takes a while. It took 2 min 15 sec to boot into motionEye OS.
    • The ip can be found by saying Net Analyzer (it'll show MEYE-XXXXXXXX) or the Fing app on iOS. Fing on iOS does not identify raspberry pi running Raspbian but the nmap can (sudo nmap -sP 192.168.1.1/24).
    • The static ip can be set if we go to the Setup > Network page.

My motionEyeOS settings

  • motionEye: 0.39.2
  • Motion: 4.1.1
  • Service: samba=Off
  • Expert settings: GPU=128
  • Video devices: 800x600, video rotation=180, frame rate=10 (Pi Zero W), 1600x1200, video rotation=0, frame rate=15->10 (Pi 2B). Note: changing the video frame rate will immediately change the streaming frame rate. So we need to remember to modify the streaming frame rate. Using frame rate=20 will make the video pixeled.
  • Text overlay: Left=disabled
  • Video streaming: streaming frame rate=2, streaming quality=85%, streaming resolution=50%, streaming port=8082.
  • Still images: off
  • Movies: H.264/OMX (.mp4), movie quality=75%, Motion trigger, maximum movie length=120 seconds, Preserve movies=1 week
  • Motion detection: frame rate threshold=1%, auto noise detection, light switch detection=75%, motion gap=10, capture before=5, capture after=5, minimum motion frame=5 (or go 20 by default), Mask=on, Show frame changes=on.
  • Working schedule: On.

Metadata

On Ubuntu install mediainfo and run mediainfo XXX.mp4 to see the metadata.

With 800x600 resolution and 6 FPS, 1 minute video uses 12.7 MB.

Tips

Monitor the USB storage from another computer

Note the $PATH is empty when we try to run a command in ssh.

$ ssh [email protected] date
Welcome to pizero2!
sh: date: No such file or directory
$ ssh myremoteserver 'echo $PATH'
Welcome to pizero2!
$ 

Suppose the USB drive is mounted on /data/media/sda1.

$ ssh [email protected] '/bin/ls -lh /data/media/sda1/2019-09-28 | /usr/bin/tail -n 1'
Welcome to pizero2!
-rw-rw-rw-    1 root     root       59.5M Sep 28 18:57 18-45-37.mp4

USB storage

  • Use a large capacity USB drive for storage (GParted formatted to ext4). It will be mounted to /data/media/sda1 in my case. So this is the path I need to enter for the 'Root Directory' under the 'File Storage' category.
  • For some reason, the external USB drive was not mounted but the data was still saved to microSD card. See this post USB drive not listed in File Storage dropdown. Unplug the USB drive and plug it in Ubuntu 18.04. Still cannot mount it with sudo mount -t ext4 /dev/sdb1 /mnt. The error message is "can't read superblock on /dev/sdb1". Use sudo fsck /dev/sdb1 command and it shows "Journal checksum error" (same error as I saw from dmesg.log log file in motioneyeos). It will ask to fix it. Answer "yes" a few times as needed and it will exit automatically. Now I can mount the USB drive in Ubuntu 18.04 and also have it recognized again in motioneyeos. In fact, fsck is available in motioneyeos too. It seems to be a good idea to run fsck periodically and send a message if something is wrong.
  • (5/6/2019) For some reason the images for some dates disappeared. In fact, the images are not lost after I fixed it on 5/10/2019.
  • (5/10/2019) I update motionEyeOS to the latest (20190427). However the samsung external USB drive can't be detected. mount command shows a superblock error. Plug the flash drive in Ubuntu and run "sudo fsck -yf /dev/sdd1". It shows an error. The error asks to get a new version of e2fsck. I follow the instruction here to do install the newest e2fsck. Run fsck again and something was fixed. Plug the drive into Raspi and the drive is recognized (df -h).
    $ sudo fsck -yf /dev/sdd1
    [sudo] password for brb: 
    fsck from util-linux 2.27.1
    e2fsck 1.42.13 (17-May-2015)
    /dev/sdd1 has unsupported feature(s): metadata_csum
    e2fsck: Get a newer version of e2fsck!
    
    # Update e2fsck
    
    $ e2fsck -V
    e2fsck 1.44.5 (15-Dec-2018)
    	Using EXT2FS Library version 1.44.5, 15-Dec-2018
    $ sudo fsck -yf /dev/sdd1
    fsck 1.44.5 (15-Dec-2018)
    e2fsck 1.44.5 (15-Dec-2018)
    samsung: recovering journal
    JBD2: Invalid checksum recovering block 6 in log
    Journal checksum error found in samsung
    Pass 1: Checking inodes, blocks, and sizes
    Pass 2: Checking directory structure
    Pass 3: Checking directory connectivity
    Pass 4: Checking reference counts
    Pass 5: Checking group summary information
    Free blocks count wrong (27612652, counted=29793316).
    Fix? yes
    
    Free inodes count wrong (7836079, counted=7838321).
    Fix? yes
    
    samsung: ***** FILE SYSTEM WAS MODIFIED *****
  • (7/11/2020) I update motionEyeOS to the latest (20200606). I also change the (Video Device) video resolution from 800x600 to 1280x720 (the frame rate looks the same).

Log files

  • Log files (motion.log, motioneye.log, messages.log, boot.log and dmesg.log) can be accessed directly from the web interface (under "Expert Settings"). All except <messages.log> can be found in /var/log directory. The <messages.log> is coming from <messages> file in /data/log.

Backup/restore settings

  • We can backup and restore the current settings
  • "motion.conf"
  • Getting a reboot loop problem on my 16GB microSD. It may be caused by using up the storage.
  • The Backup configuration file is called "motioneye-config.tar.gz". When we restore, it will ask to browse the file from the local drive.

Run a command

Motion trigger

  • Threshold and mask. Hard to set up the motion trigger. #695
  • Pi zero. Motion trigger function on Pi zero is not stable even I set frame change threshold 0.1%. Ssh to Pi zero shows the CPU usage is consistently high (> 90%). Even "continuous recording" is not stable on Pi zero. This leaves only the streaming and interval snapshots for still images option for pi zero.
    • Still images. Capture mode: Motion trigger, Motion trigger (one picture), Interval snapshots, All frames, Manual.
    • There is a timelapse button under the "Open Picture Browser" window. The created timelapse video is in a avi format and downloaded automatically (check browser's setting if the download is blocked). Works fine on Pi zero. We change change the "snapshot interval" in seconds and increase the resolution.
  • 4:3 aspect ratio:
    • 800x600
    • 1024x768
    • 1280x960
    • 1440x1080
    • 1600*1200: 171 KB for a picture (or .6 GB per hour)
  • 16:9 aspect ratio
  • Table of actually frame rate depending on the resolution and target frame rate from my experiment (HW: Pi2):
resolution target fr 15 target fr 30
1600x1200 8.6
1280x1024 8.6
1280x720 11.65
1024x768 13 15
800x600 15 23.5

False positive

How to deal with tree leaves shadow moves with wind (don't want to use 'Edit Mask')

MotionSetting.png

df -h

I plug in a 128GB USB drive.

[root@meye-43815721 ~]# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root               193.7M    173.7M      5.9M  97% /
devtmpfs                369.9M         0    369.9M   0% /dev
tmpfs                   374.4M     16.0K    374.4M   0% /dev/shm
tmpfs                   374.4M      2.3M    372.1M   1% /tmp
/dev/mmcblk0p1           29.9M     13.9M     16.0M  46% /boot
/dev/mmcblk0p3           13.6G    151.9M     12.7G   1% /data
/dev/mmcblk0p3           13.6G    151.9M     12.7G   1% /home/ftp/sdcard
/dev/mmcblk0p3           13.6G    151.9M     12.7G   1% /home/ftp/storage
/dev/sda1               117.2G     11.8G     99.3G  11% /data/media/sda1
/dev/sda1               117.2G     11.8G     99.3G  11% /home/ftp/storage/sda1