Motioneye: Difference between revisions
(→Eufy) |
|||
(49 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
* [https://pimylifeup.com/raspberry-pi-webcam-server/ Build a Raspberry Pi Webcam Server in Minutes] (using .deb) | * [https://pimylifeup.com/raspberry-pi-webcam-server/ Build a Raspberry Pi Webcam Server in Minutes] (using .deb) | ||
* [http://www.instructables.com/id/Raspberry-Pi-as-low-cost-HD-surveillance-camera/step7/Installing-the-motion-detection-software/ Raspberry Pi as low-cost HD surveillance camera]. Some highlights includes installing the motion detection software, saving videos on Windows shared folder, and accessing the live stream. (using apt-get) | * [http://www.instructables.com/id/Raspberry-Pi-as-low-cost-HD-surveillance-camera/step7/Installing-the-motion-detection-software/ Raspberry Pi as low-cost HD surveillance camera]. Some highlights includes installing the motion detection software, saving videos on Windows shared folder, and accessing the live stream. (using apt-get) | ||
* [https://motion-project.github.io/motion_guide.html Documentation] | |||
= motionEye = | = motionEye = | ||
Line 9: | Line 10: | ||
* [https://github.com/ccrisan/motioneye/wiki wiki] | * [https://github.com/ccrisan/motioneye/wiki wiki] | ||
= motionEyeOS = | = motionEyeOS, hashed password = | ||
* [https://github.com/ccrisan/motioneyeos motionEyeOS] (50MB for raspberry pi 20180627, not a regular Linux OS) | * [https://github.com/ccrisan/motioneyeos motionEyeOS] (50MB for raspberry pi 20180627, not a regular Linux OS) | ||
* [https://github.com/ccrisan/motioneyeos/wiki Wiki] | * [https://github.com/ccrisan/motioneyeos/wiki Wiki] | ||
* According to its [https://github.com/ccrisan/motioneyeos/wiki/FAQ FAQ], the default username is 'admin' with no password. | ** [https://github.com/ccrisan/thingos/wiki/Getting-Started First boot]. It is recommended that you do your first boot with a monitor attached. | ||
* According to its [https://github.com/ccrisan/motioneyeos/wiki/FAQ FAQ], the default username is '''admin''' with no password. | |||
* [https://www.raspberrypi-spy.co.uk/2017/04/raspberry-pi-zero-w-cctv-camera-with-motioneyeos/ Raspberry Pi Zero W CCTV Camera with motionEyeOS]. Note that if we are using Pi Zero W w/o a monitor, we need to create a file '''/boot/wpa_supplicant.conf'''. See also [https://github.com/ccrisan/motioneyeos/wiki/Wifi-Preconfiguration Wifi Preconfiguration] for Pi Zero W. To create a hash password, using '''[https://wiki.archlinux.org/index.php/WPA_supplicant wpa_passphrase]''' or '''[https://github.com/caike/supplicant-psk supplicant-psk]'''. | * [https://www.raspberrypi-spy.co.uk/2017/04/raspberry-pi-zero-w-cctv-camera-with-motioneyeos/ Raspberry Pi Zero W CCTV Camera with motionEyeOS]. Note that if we are using Pi Zero W w/o a monitor, we need to create a file '''/boot/wpa_supplicant.conf'''. See also [https://github.com/ccrisan/motioneyeos/wiki/Wifi-Preconfiguration Wifi Preconfiguration] for Pi Zero W. To create a hash password, using '''[https://wiki.archlinux.org/index.php/WPA_supplicant wpa_passphrase]''' or '''[https://github.com/caike/supplicant-psk supplicant-psk]'''. | ||
* For static IP, create a new file | * For static IP, create a new file [https://github.com/ccrisan/thingos/wiki/static_ip.conf /boot/static_ip.conf]. See https://github.com/ccrisan/thingos/wiki/static_ip.conf, https://github.com/motioneye-project/motioneyeos/wiki/Tweaks#manually-editing-network-configuration | ||
* If we still want to change the IP after the first boot, modify the file '''/data/etc/static_ip.conf ''' where '''data''' is the largest partition of the SD card (not the OS partition which is about 231MB) | |||
<ul> | |||
<li>Summary of the setup (for some reason, the static ip does not work so a different way to find the IP is needed) | |||
<ul> | |||
<li>touch ssh </li> | |||
<li>cp ~/Downloads/static_ip.conf . (optional) </li> | |||
<li>cp ~/Downloads/wpa_supplicant.conf . </li> | |||
<li>nano static_ip.conf (optional) | |||
<pre> | |||
static_ip="192.168.1.14/24" | |||
static_gw="192.168.1.1" | |||
static_dns="8.8.8.8" | |||
</pre> | |||
</li> | |||
<li>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. </li> | |||
<li>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)'''. </li> | |||
<li>The static ip can be set if we go to the Setup > Network page. </li> | |||
</ul> | |||
</ul> | |||
* [https://www.youtube.com/watch?v=8YUM7jio6dk Video review] with more information by ExplainingComputers (7/15/2018). | * [https://www.youtube.com/watch?v=8YUM7jio6dk Video review] with more information by ExplainingComputers (7/15/2018). | ||
* http://pimylifeup.com/raspberry-pi-security-camera/ | * http://pimylifeup.com/raspberry-pi-security-camera/ | ||
Line 37: | Line 50: | ||
* [https://www.raspberrypi.org/magpi-issues/MagPi43.pdf#page=50 ADD PUSH NOTIFICATIONS], [https://www.raspberrypi.org/magpi-issues/MagPi73.pdf#page=66 Raspberry Pi Home CCTV] from MagPi. | * [https://www.raspberrypi.org/magpi-issues/MagPi43.pdf#page=50 ADD PUSH NOTIFICATIONS], [https://www.raspberrypi.org/magpi-issues/MagPi73.pdf#page=66 Raspberry Pi Home CCTV] from MagPi. | ||
* [https://randomnerdtutorials.com/cctv-raspberry-pi-based-system-storage-motioneyeos/ CCTV Raspberry Pi Based System with Storage using MotionEyeOS] (one hub w/ SATA and multiple Pi W) | * [https://randomnerdtutorials.com/cctv-raspberry-pi-based-system-storage-motioneyeos/ CCTV Raspberry Pi Based System with Storage using MotionEyeOS] (one hub w/ SATA and multiple Pi W) | ||
== Hashed and peppered passwords == | |||
* [https://www.makeuseof.com/what-is-peppering-how-does-it-work/ What Is Peppering in Password Security and How Does It Work?] | |||
* [https://alphasec.io/secure-passwords-with-salt-pepper-and-hash-what/ Secure Passwords with Salt, Pepper and Hash. What?!] | |||
= My motionEyeOS settings = | = My motionEyeOS settings = | ||
Line 50: | Line 67: | ||
* 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. | * 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. | * 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 = | = Tips = | ||
Line 70: | Line 92: | ||
-rw-rw-rw- 1 root root 59.5M Sep 28 18:57 18-45-37.mp4 | -rw-rw-rw- 1 root root 59.5M Sep 28 18:57 18-45-37.mp4 | ||
</pre> | </pre> | ||
== Partitions == | |||
On my SD card, | |||
* /boot (/dev/mmcblk0p1, 30MB) is vfat | |||
* the rest partitions are all ext4 | |||
== USB storage == | == USB storage == | ||
Line 107: | Line 134: | ||
samsung: ***** FILE SYSTEM WAS MODIFIED ***** | samsung: ***** FILE SYSTEM WAS MODIFIED ***** | ||
</syntaxhighlight> | </syntaxhighlight> | ||
* (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). | |||
* (6/25/2022) Retire over 3 years old samsung 128GB usb drive. The drive is unstable in motionEye and cannot be detected in Ubuntu 20.04 OS. If I am not using a USB drive, I'll need to consider a powered usb hub if I want to connect an SSD. | |||
* (11/3/2022) Reboot failure. Cannot ping. After reboot, only see 3 raspberries without any text. Another boot will fix everything. | |||
* HDD lifespan is around 3-4 years. But if it used as a CCTV recorder, it will significantly shorten its life. | |||
* (11/16/2022) <syntaxhighlight lang='bash'> | |||
$ sudo fsck -yf /dev/sdb1 | |||
fsck from util-linux 2.34 | |||
fsck.fat 4.1 (2017-01-24) | |||
0x25: Dirty bit is set. Fs was not properly unmounted and some data may be corrupt. | |||
Automatically removing dirty bit. | |||
Performing changes. | |||
/dev/sdb1: 196 files, 7873/15321 clusters | |||
</syntaxhighlight> | |||
* Originally SSDs were less suited to use in CCTV recorders as they had limited write cycles so their life was shortened very quickly when used continuously. There are now, however, new types of SSD that are designed for use in servers and other write intensive devices which makes them better suited to CCTV recorders. It is important when selecting an SSD for use in CCTV that it states it is for use in write intensive applications. | |||
== Storage: Network share == | |||
* The '''Share name''' is the most difficult part. | |||
* See a screenshot [https://randomnerdtutorials.com/cctv-raspberry-pi-based-system-storage-motioneyeos/ Configuring File Storage For the RPi Zero] | |||
* [https://www.reddit.com/r/raspberry_pi/comments/e7871p/motion_eye_on_raspberry_pi_3b_network_share/?utm_source=share&utm_medium=web2x&context=3 Motion Eye on Raspberry Pi 3b network share settings] (tutorial) | |||
== Log files == | == Log files == | ||
* | All are under '''/var/log''' directory. | ||
* motion.log | |||
* '''motioneye.log''': useful to find out regularly if there are any errors. It would be good if we can scan this file every day and email if there is any ERROR in this file. See below for more info. | |||
* messages | |||
* boot.log: useful to find out the booting date/time from the history | |||
* dmesg.log | |||
* "dmesg -L -T" command to show the date/time | |||
These files can be downloaded 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'''. PS. it seems /var/log and /data/log has the same contents. | |||
[https://github.com/ccrisan/motioneyeos/issues/1661 Motioneyeos Webserver,MJPEG server and SSH don't respond after one day, ping still works on Raspberry PI Zero W] | |||
(11/4/2020). System has no response. Use "grep -i error FILENAME" to get some error messages. Still no clear answer to no response problem. | |||
* dmesg.log: | |||
** print_req_error: I/O error, dev sda, sector 0 | |||
** EXT4-fs error (device sda1): ext4_find_entry:1455: inode #2: comm python: reading directory lblock 0 | |||
** EXT4-fs error (device sda1): ext4_find_entry:1455: inode #2: comm ml1:FrontWindow: reading directory lblock 0 | |||
* messages: | |||
** [ERR] [EVT] event_ffmpeg_newfile: Error opening context for movie output. | |||
** [ERR] [ENC] ffmpeg_set_outputfile: Error opening file /data/media/sda1/2020-11-04/07-31-56.mp4: Input/output error | |||
* '''motioneye.log''': | |||
** ERROR: failed to cleanup media files: [Errno 5] Input/output error: '/data/media/sda1/.keep' IOError: [Errno 5] Input/output error: '/data/media/sda1/.keep' | |||
** ERROR: failed to create movie preview for /data/media/sda1/2020-10-28/07-32-42.mp4: Command '[u'ffmpeg', u'-i', u'/data/media/sda1/2020-10-28/07-32-42.mp4', u'-f', u'mjpeg', u'-vframes', u'1', u'-ss', u'4', u'-y', u'/data/media/sda1/2020-10-28/07-32-42.mp4.thumb']' returned non-zero exit status 1 | |||
** ERROR: failed to get config for remote camera 1 on http://192.168.1.11/config/1: Failed to connect to 192.168.1.11 port 80: No route to host | |||
(1/12/2021). System has no response (got an email notice from my another server's cron job which pings the motioneyeOS box every 6 hours). I am following [https://github.com/ccrisan/motioneyeos/issues/887 this message] to use crontab to schedule reboot every morning at 5AM. | |||
* '''grep $(date +%Y-%m-%d) /var/log/motioneye.log | grep ERROR | wc -l ''' | |||
* cleanup_interval parameter (mine is 3600). See [https://github.com/ccrisan/motioneyeos/wiki/motioneye.conf /data/etc/motioneye.conf]. Follow the wiki, I change is to 43200 (12 hours/twice a day). | |||
* Maybe I should try to save files to a network shared folder? | |||
(8/26/2021). System has no response. ping returns unreachable. ssh returns no route to host. Network Analyzer Pro does not show the IP. scp dmesg.log, motion.log, motioneye.log, boot.log and messages files back to investigation. | |||
* '''messages''' file shows the last message was 'user.notice throttlewatch: currently: ok, temperature: 47 C'. That happened when the system restarted. And it is the only message after the system restarted. The next message is supposed to be "user.notice date: current system date/time set to ...." and cron related messaages. | |||
* dmesg.log does not show any interesting message | |||
* motioneye.log does not show any interesting message | |||
* motion.log does not show any interesting message | |||
* boot.log does not show any interesting message | |||
* Change crontab to reboot on every Sunday instead of every day | |||
== What date it was installed == | |||
Check out the folder '''/data/etc/ssh''' | |||
== Backup/restore settings == | == Backup/restore settings == | ||
Line 121: | Line 207: | ||
* [https://github.com/ccrisan/motioneyeos/wiki/Tweaks#running-commands-at-regular-intervals-cron-support Running Commands At Regular Intervals (Cron Support)] | * [https://github.com/ccrisan/motioneyeos/wiki/Tweaks#running-commands-at-regular-intervals-cron-support Running Commands At Regular Intervals (Cron Support)] | ||
== Motion trigger == | == Manually record a video == | ||
[https://github.com/motioneye-project/motioneye/issues/229 (Feature) Option to manually start and stop recording? #229]. It works. If I try to use the IP, I got an error: Couldn't connect to server. '''Port 7999''' is the default ''' "command/control" ''' port for motion. | |||
<pre> | |||
/usr/bin/curl "http://localhost:7999/1/config/set?emulate_motion=1" | |||
/usr/bin/curl "http://localhost:7999/1/config/set?emulate_motion=0" | |||
</pre> | |||
If we want to run the command remotely, we can use [[Ssh#Running_commands_on_a_remote_host|SSH to run a command line on a remote host]] | |||
<pre> | |||
ssh [email protected] curl "http://localhost:7999/1/config/set?emulate_motion=1" | |||
ssh [email protected] curl "http://localhost:7999/1/config/set?emulate_motion=0" | |||
</pre> | |||
We can create an alias in the .bashrc file: | |||
{{Pre}} | |||
<nowiki>alias meye1='ssh [email protected] "curl 'http://localhost:7999/1/config/set?emulate_motion=1'"' | |||
alias meye0='ssh [email protected] "curl 'http://localhost:7999/1/config/set?emulate_motion=0'"'</nowiki> | |||
</pre> | |||
== Configuration file == | |||
* https://github.com/motioneye-project/motioneye/wiki/Configuration-File | |||
* Port 7999 is the TCP port for the motion daemon's HTTP control server. | |||
** [https://www.reddit.com/r/homeautomation/comments/7wgxgt/motioneye_based_presence_detection_with_recording/ MotionEye based presence detection with recording] | |||
** [https://groups.google.com/g/motioneye/c/YEt3Gv3y7dw How to enable web control over port 7999 in motioneyeOS??] | |||
** [https://community.home-assistant.io/t/raspberry-pi-zero-camera-surveillance-system/58040/4 Raspberry pi zero camera - surveillance system] | |||
* Port 8765 is the TCP port on which the motionEye server will listen. | |||
== Motion trigger, Pi zero W == | |||
* 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. | |||
** '''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" | ||
Line 171: | Line 293: | ||
/dev/sda1 117.2G 11.8G 99.3G 11% /home/ftp/storage/sda1 | /dev/sda1 117.2G 11.8G 99.3G 11% /home/ftp/storage/sda1 | ||
</pre> | </pre> | ||
= ZoneMinder server = | |||
<ul> | |||
<li>[https://raspberrytips.com/install-zoneminder-raspberry-pi/ How to Install ZoneMinder on Raspberry Pi? (Surveillance Monitor)] | |||
<li>[https://www.techradar.com/how-to/computing/use-a-raspberry-pi-to-remotely-watch-your-home-1314466 How to use a Raspberry Pi to remotely watch your home]. Install '''Motion''' to stream video to ZoneMinder server. | |||
<li>AI | |||
<ul> | |||
<li>Step 1: Set Up the Raspberry Pi as an IP Camera | |||
<li>Install motion on the Raspberry Pi: | |||
<pre> | |||
sudo apt-get update | |||
sudo apt-get install motion | |||
</pre> | |||
<li>Configure 'motion' | |||
<pre> | |||
sudo nano /etc/motion/motion.conf | |||
</pre> | |||
Modify the following settings | |||
<pre> | |||
daemon on | |||
stream_localhost off | |||
stream_port 8081 | |||
framerate 2 | |||
width 640 | |||
height 480 | |||
</pre> | |||
<li>Enable the motion daemon: sudo nano /etc/default/motion | |||
<pre> | |||
start_motion_daemon=yes | |||
</pre> | |||
<li>Start the motion service: sudo service motion start | |||
<li>Test the IP camera: http://<raspberry_pi_ip>:8081 | |||
<li>Step 2: Install ZoneMinder on Another Computer | |||
<li>Install ZoneMinder: | |||
<pre> | |||
sudo apt-get update | |||
sudo apt-get install zoneminder | |||
</pre> | |||
<li>Start and enable ZoneMinder: | |||
<pre> | |||
sudo systemctl start zoneminder | |||
sudo systemctl enable zoneminder | |||
</pre> | |||
<li>Access ZoneMinder Web Interface: http://<your_computer_ip>/zm | |||
<li>Step 3: Add the Raspberry Pi Camera to ZoneMinder | |||
* Log in to the ZoneMinder web interface. | |||
* Add a new monitor | |||
** Click on "Add". Set the following options: | |||
*** Source Type: Remote | |||
*** Function: Monitor | |||
*** Enabled: Yes | |||
* Configure the Source: In the Source tab, set: | |||
** Remote Protocol: HTTP | |||
** Remote Method: Simple | |||
** Remote Host Name: <raspberry_pi_ip> | |||
** Remote Host Port: 8081 | |||
** Remote Host Path: / | |||
** Capture Width (pixels): 640 | |||
** Capture Height (pixels): 480 | |||
* Save the monitor settings. | |||
<li>Step 4: Verify the Setup | |||
</ul> | |||
<li>[https://forums.raspberrypi.com/viewtopic.php?t=89780 h264 streaming to zoneminder] | |||
</ul> | |||
= Add camera = | |||
[[File:Add camera.png|250px]] | |||
* I'm choosing MMAL camera (2nd selection) with a camera module. | |||
* [https://forums.raspberrypi.com/viewtopic.php?t=206310 MMAL vs V4L2]. MMAL is Broadcom specific, but exposes all the features of the hardware. | |||
== RTSM camera == | |||
[https://reolink.com/blog/rtsp-ip-camera-and-best-rtsp-camera-buying-guide/ What’s RTSP IP Camera & Best RTSP IP Cameras Buying Guide] | |||
= Youtube live streaming = | |||
[https://www.raspberrypi.org/blog/watch-wildlife-with-a-raspberry-pi-nature-camera-hackspace-33/ Watch wildlife with a Raspberry Pi nature camera] | |||
= Eufy = | |||
* [https://ankertechnologycompanyltd.my.salesforce.com/sfc/p/#5g000004DkWQ/a/5g000000g3b3/8aSfN7jDpEtIwd24.12sz8Tj.i4jj89LgGZVZgm4sgk Quick starter guide] for indoor camera 2K Pan & Tilt | |||
** Product page [https://www.eufy.com/products/t8410121?variant=37765865570490 T8414/E220] | |||
** [https://support.eufy.com/s/product/a085g000000Nm4BAAS/indoor-cam-2k-pan-&-tilt-(solo-indoorcam-p24) Support page] for Indoor Cam 2K Pan & Tilt (Solo IndoorCam P24). | |||
** [https://www.amazon.com/eufy-Security-Assistant-Compatibility-Tracking/dp/B0856W45VL Amazon] | |||
* [https://youtu.be/VQZOAkvZgQY?si=nWb8UpL6mP8oFESE&t=157 Eufy Indoor Cam (E220) 2K Pan & Tilt Security Camera - Setup & First Impressions!] (video) | |||
** '''SETUP''' button on the back of the camera. | |||
** Open the Eufy Security App on your mobile device. | |||
** Select “Add Device” and choose your camera model in the Device tab. | |||
** Plug the device into a power outlet before mounting it and proceed with the setup. Wait until the LED turns solid blue. | |||
** Scan the QR code on the back of the camera. | |||
** Enter Setup mode by pressing and holding the SYNC/SETUP button until you hear a beep. The status LED will turn to flashing blue. | |||
** Tap “Heard a Beep?” and wait until the camera is connected to the phone. | |||
** Continue. Select the Wi-Fi network you are going to connect and input your password. Please only use 2.4 GHz Wi-Fi. | |||
** Choose a device name from the list. | |||
* The micro SD card slot is not located around the camera len as some YT video showed. [https://www.reddit.com/r/EufyCam/comments/yeatfj/i_have_this_cam_and_cant_access_the_sd_slot_wont/ can't access the sd slot,]. Power it off using the app and it will turn in on itself exposing the SD slot. The colored part of the SD card should face down (the metal part should face up). | |||
* Settings | |||
** Motion Detection | |||
** Sound Detection | |||
** Pan-tilt settings | |||
** Pet command | |||
** Video settings | |||
** Audio settings | |||
** Notificatipn | |||
** General | |||
* [https://support.eufy.com/s/article/Using-NAS-Storage-Step-by-Step Using NAS Storage Step by Step]. Settings -> General -> Storage -> NAS (RTSP). | |||
* To power it off, go to Settings and toggle the switch shown on top-right corner. | |||
* Video Settings -> Continuous recording: 128G SD card can record 12 days. 64GB is 6 days. | |||
* If we press the "Record" button, the video will be on the Phone's Album. | |||
* We can watch the live feed from your eufy camera remotely when you're away from home by using the Eufy app or through the [https://mysecurity.eufylife.com/#/login?type=/ web portal]. | |||
** If you would like to see the live view, please go to eufy Security App -> Sidebar -> Control Center -> Web Portal Live Access and generate a Safety PIN first. Enter it to make it work. | |||
* Power consumption: 0.10A. | |||
* [https://support.eufy.com/s/article/Can-eufy-Outdoor-Cam-continue-to-record-during-WiFi-outage Can eufy Outdoor Cam continue to record during WiFi outage?] | |||
* Instead of NAS, we can use ZoneMinder, Shinobi, Frigate NVR, Motion, MotionEye | |||
* Solar-powered outdoor camera: eufy SoloCam S340 |
Latest revision as of 14:23, 23 June 2024
Motion software
- Motion
- Build a Raspberry Pi Webcam Server in Minutes (using .deb)
- Raspberry Pi as low-cost HD surveillance camera. Some highlights includes installing the motion detection software, saving videos on Windows shared folder, and accessing the live stream. (using apt-get)
- Documentation
motionEye
- It is a web frontend for the motion daemon
- v0.41 has a fix for video streaming in Chrome 76+
- wiki
motionEyeOS, hashed password
- motionEyeOS (50MB for raspberry pi 20180627, not a regular Linux OS)
- Wiki
- First boot. It is recommended that you do your first boot with a monitor attached.
- According to its FAQ, the default username is admin with no password.
- Raspberry Pi Zero W CCTV Camera with motionEyeOS. Note that if we are using Pi Zero W w/o a monitor, we need to create a file /boot/wpa_supplicant.conf. See also Wifi Preconfiguration for Pi Zero W. To create a hash password, using wpa_passphrase or supplicant-psk.
- For static IP, create a new file /boot/static_ip.conf. See https://github.com/ccrisan/thingos/wiki/static_ip.conf, https://github.com/motioneye-project/motioneyeos/wiki/Tweaks#manually-editing-network-configuration
- If we still want to change the IP after the first boot, modify the file /data/etc/static_ip.conf where data is the largest partition of the SD card (not the OS partition which is about 231MB)
- 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.
- Video review with more information by ExplainingComputers (7/15/2018).
- http://pimylifeup.com/raspberry-pi-security-camera/
- Motion Detection Settings
- motionEye (install motionEye on your Linux machine)
- Top right integer: the number of changed pixels
- Low FPS. Live stream loads the CPU. The hardware acceleration is only enabled for video encoding, i.e. recording movie. When encoding is offloaded to the GPU, all the Raspberry Pi models gives similar performance. The bottleneck is the memory bandwidth.
- What is the "fps" overlay: streaming/capture frame rate. Streaming fr is under 'Video Streaming' and capture fr is under 'Video Device'. The actual capture frame rate will depend on the performance of the device as well as on the available bandwidth when communicating with the camera.
- How motion gap works
- Even using Raspi Zero W, if I use the linux command to record a 1080p video, the frame rate is 25. But if I use motionEye, I can get only 10 frame rate even the resolution is reduced to 800 x 600.
- 'top' command shows 25% cpu usage on Pi 2B (quad core). So running motion detection on Pi Zero (single core) does not make sense. It is probably OK for using motioneyeos as a camera only on Pi Zero. When a motion is detected and recorded on Pi 2B, the cpu usage (still 25%) is not increased as I see using the 'top' command.
- Low Frame rate on Pi Zero W, Hardware acceleration for Raspberry Pi Zero W. The '20170827' release contains lots of tuning information on Pi Zero W.
- Streaming is using mjpeg but recording is using h.264
- ADD PUSH NOTIFICATIONS, Raspberry Pi Home CCTV from MagPi.
- CCTV Raspberry Pi Based System with Storage using MotionEyeOS (one hub w/ SATA and multiple Pi W)
Hashed and peppered passwords
- What Is Peppering in Password Security and How Does It Work?
- Secure Passwords with Salt, Pepper and Hash. What?!
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
Partitions
On my SD card,
- /boot (/dev/mmcblk0p1, 30MB) is vfat
- the rest partitions are all ext4
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).
- (6/25/2022) Retire over 3 years old samsung 128GB usb drive. The drive is unstable in motionEye and cannot be detected in Ubuntu 20.04 OS. If I am not using a USB drive, I'll need to consider a powered usb hub if I want to connect an SSD.
- (11/3/2022) Reboot failure. Cannot ping. After reboot, only see 3 raspberries without any text. Another boot will fix everything.
- HDD lifespan is around 3-4 years. But if it used as a CCTV recorder, it will significantly shorten its life.
- (11/16/2022)
$ sudo fsck -yf /dev/sdb1 fsck from util-linux 2.34 fsck.fat 4.1 (2017-01-24) 0x25: Dirty bit is set. Fs was not properly unmounted and some data may be corrupt. Automatically removing dirty bit. Performing changes. /dev/sdb1: 196 files, 7873/15321 clusters
- Originally SSDs were less suited to use in CCTV recorders as they had limited write cycles so their life was shortened very quickly when used continuously. There are now, however, new types of SSD that are designed for use in servers and other write intensive devices which makes them better suited to CCTV recorders. It is important when selecting an SSD for use in CCTV that it states it is for use in write intensive applications.
- The Share name is the most difficult part.
- See a screenshot Configuring File Storage For the RPi Zero
- Motion Eye on Raspberry Pi 3b network share settings (tutorial)
Log files
All are under /var/log directory.
- motion.log
- motioneye.log: useful to find out regularly if there are any errors. It would be good if we can scan this file every day and email if there is any ERROR in this file. See below for more info.
- messages
- boot.log: useful to find out the booting date/time from the history
- dmesg.log
- "dmesg -L -T" command to show the date/time
These files can be downloaded 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. PS. it seems /var/log and /data/log has the same contents.
(11/4/2020). System has no response. Use "grep -i error FILENAME" to get some error messages. Still no clear answer to no response problem.
- dmesg.log:
- print_req_error: I/O error, dev sda, sector 0
- EXT4-fs error (device sda1): ext4_find_entry:1455: inode #2: comm python: reading directory lblock 0
- EXT4-fs error (device sda1): ext4_find_entry:1455: inode #2: comm ml1:FrontWindow: reading directory lblock 0
- messages:
- [ERR] [EVT] event_ffmpeg_newfile: Error opening context for movie output.
- [ERR] [ENC] ffmpeg_set_outputfile: Error opening file /data/media/sda1/2020-11-04/07-31-56.mp4: Input/output error
- motioneye.log:
- ERROR: failed to cleanup media files: [Errno 5] Input/output error: '/data/media/sda1/.keep' IOError: [Errno 5] Input/output error: '/data/media/sda1/.keep'
- ERROR: failed to create movie preview for /data/media/sda1/2020-10-28/07-32-42.mp4: Command '[u'ffmpeg', u'-i', u'/data/media/sda1/2020-10-28/07-32-42.mp4', u'-f', u'mjpeg', u'-vframes', u'1', u'-ss', u'4', u'-y', u'/data/media/sda1/2020-10-28/07-32-42.mp4.thumb']' returned non-zero exit status 1
- ERROR: failed to get config for remote camera 1 on http://192.168.1.11/config/1: Failed to connect to 192.168.1.11 port 80: No route to host
(1/12/2021). System has no response (got an email notice from my another server's cron job which pings the motioneyeOS box every 6 hours). I am following this message to use crontab to schedule reboot every morning at 5AM.
- grep $(date +%Y-%m-%d) /var/log/motioneye.log | grep ERROR | wc -l
- cleanup_interval parameter (mine is 3600). See /data/etc/motioneye.conf. Follow the wiki, I change is to 43200 (12 hours/twice a day).
- Maybe I should try to save files to a network shared folder?
(8/26/2021). System has no response. ping returns unreachable. ssh returns no route to host. Network Analyzer Pro does not show the IP. scp dmesg.log, motion.log, motioneye.log, boot.log and messages files back to investigation.
- messages file shows the last message was 'user.notice throttlewatch: currently: ok, temperature: 47 C'. That happened when the system restarted. And it is the only message after the system restarted. The next message is supposed to be "user.notice date: current system date/time set to ...." and cron related messaages.
- dmesg.log does not show any interesting message
- motioneye.log does not show any interesting message
- motion.log does not show any interesting message
- boot.log does not show any interesting message
- Change crontab to reboot on every Sunday instead of every day
What date it was installed
Check out the folder /data/etc/ssh
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
Manually record a video
(Feature) Option to manually start and stop recording? #229. It works. If I try to use the IP, I got an error: Couldn't connect to server. Port 7999 is the default "command/control" port for motion.
/usr/bin/curl "http://localhost:7999/1/config/set?emulate_motion=1" /usr/bin/curl "http://localhost:7999/1/config/set?emulate_motion=0"
If we want to run the command remotely, we can use SSH to run a command line on a remote host
ssh [email protected] curl "http://localhost:7999/1/config/set?emulate_motion=1" ssh [email protected] curl "http://localhost:7999/1/config/set?emulate_motion=0"
We can create an alias in the .bashrc file:
alias meye1='ssh [email protected] "curl 'http://localhost:7999/1/config/set?emulate_motion=1'"' alias meye0='ssh [email protected] "curl 'http://localhost:7999/1/config/set?emulate_motion=0'"'
Configuration file
- https://github.com/motioneye-project/motioneye/wiki/Configuration-File
- Port 7999 is the TCP port for the motion daemon's HTTP control server.
- Port 8765 is the TCP port on which the motionEye server will listen.
Motion trigger, Pi zero W
- 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')
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
ZoneMinder server
- How to Install ZoneMinder on Raspberry Pi? (Surveillance Monitor)
- How to use a Raspberry Pi to remotely watch your home. Install Motion to stream video to ZoneMinder server.
- AI
- Step 1: Set Up the Raspberry Pi as an IP Camera
- Install motion on the Raspberry Pi:
sudo apt-get update sudo apt-get install motion
- Configure 'motion'
sudo nano /etc/motion/motion.conf
Modify the following settings
daemon on stream_localhost off stream_port 8081 framerate 2 width 640 height 480
- Enable the motion daemon: sudo nano /etc/default/motion
start_motion_daemon=yes
- Start the motion service: sudo service motion start
- Test the IP camera: http://<raspberry_pi_ip>:8081
- Step 2: Install ZoneMinder on Another Computer
- Install ZoneMinder:
sudo apt-get update sudo apt-get install zoneminder
- Start and enable ZoneMinder:
sudo systemctl start zoneminder sudo systemctl enable zoneminder
- Access ZoneMinder Web Interface: http://<your_computer_ip>/zm
- Step 3: Add the Raspberry Pi Camera to ZoneMinder
- Log in to the ZoneMinder web interface.
- Add a new monitor
- Click on "Add". Set the following options:
- Source Type: Remote
- Function: Monitor
- Enabled: Yes
- Click on "Add". Set the following options:
- Configure the Source: In the Source tab, set:
- Remote Protocol: HTTP
- Remote Method: Simple
- Remote Host Name: <raspberry_pi_ip>
- Remote Host Port: 8081
- Remote Host Path: /
- Capture Width (pixels): 640
- Capture Height (pixels): 480
- Save the monitor settings.
- Step 4: Verify the Setup
- h264 streaming to zoneminder
Add camera
- I'm choosing MMAL camera (2nd selection) with a camera module.
- MMAL vs V4L2. MMAL is Broadcom specific, but exposes all the features of the hardware.
RTSM camera
What’s RTSP IP Camera & Best RTSP IP Cameras Buying Guide
Youtube live streaming
Watch wildlife with a Raspberry Pi nature camera
Eufy
- Quick starter guide for indoor camera 2K Pan & Tilt
- Product page T8414/E220
- Support page for Indoor Cam 2K Pan & Tilt (Solo IndoorCam P24).
- Amazon
- Eufy Indoor Cam (E220) 2K Pan & Tilt Security Camera - Setup & First Impressions! (video)
- SETUP button on the back of the camera.
- Open the Eufy Security App on your mobile device.
- Select “Add Device” and choose your camera model in the Device tab.
- Plug the device into a power outlet before mounting it and proceed with the setup. Wait until the LED turns solid blue.
- Scan the QR code on the back of the camera.
- Enter Setup mode by pressing and holding the SYNC/SETUP button until you hear a beep. The status LED will turn to flashing blue.
- Tap “Heard a Beep?” and wait until the camera is connected to the phone.
- Continue. Select the Wi-Fi network you are going to connect and input your password. Please only use 2.4 GHz Wi-Fi.
- Choose a device name from the list.
- The micro SD card slot is not located around the camera len as some YT video showed. can't access the sd slot,. Power it off using the app and it will turn in on itself exposing the SD slot. The colored part of the SD card should face down (the metal part should face up).
- Settings
- Motion Detection
- Sound Detection
- Pan-tilt settings
- Pet command
- Video settings
- Audio settings
- Notificatipn
- General
- Using NAS Storage Step by Step. Settings -> General -> Storage -> NAS (RTSP).
- To power it off, go to Settings and toggle the switch shown on top-right corner.
- Video Settings -> Continuous recording: 128G SD card can record 12 days. 64GB is 6 days.
- If we press the "Record" button, the video will be on the Phone's Album.
- We can watch the live feed from your eufy camera remotely when you're away from home by using the Eufy app or through the web portal.
- If you would like to see the live view, please go to eufy Security App -> Sidebar -> Control Center -> Web Portal Live Access and generate a Safety PIN first. Enter it to make it work.
- Power consumption: 0.10A.
- Instead of NAS, we can use ZoneMinder, Shinobi, Frigate NVR, Motion, MotionEye
- Solar-powered outdoor camera: eufy SoloCam S340