Coder Social home page Coder Social logo

408apple / yi-outdoor-camera-1080p-backup-script Goto Github PK

View Code? Open in Web Editor NEW

This project forked from seasonw/yi-outdoor-camera-1080p-backup-script

0.0 0.0 0.0 960 KB

Backup shell script for Yi Outdoor Camera 1080p

License: GNU General Public License v3.0

Shell 100.00%

yi-outdoor-camera-1080p-backup-script's Introduction

Backup shell script for Yi Outdoor Camera 1080p


Purpose

I have a chance to work on a Yi Outdoor 1080p Camera, main purpose is to find out a way to save recorded videos to a larger storage in order to have more days of video backup. This is because SD card will be overwritten once storage full, a 64GB SD card can store less than 7 days video recorded in 1080p.



Camera's default feature for storage

The only methods to save more videos in the camera's default feature is:-
  1. Increase SD card storage (but we don't know if the camera will work well on SD card larger than max storage as stated in the specification - 64GB).
  2. Pay to use Yi Cloud (never try out, but I assumed cloud storage can be customized with $$$).


Yi Camera Hack

I found Yi Camera's firmware can be hacked (https://github.com/TheCrypt0/yi-hack-v4) to have more features such as SSH, FTP, RTSP, etc. This is a good start and I decided to try it out. It is simple, just follow the instruction and extract 2 firmware files to SD card's root folder will do.

At first I was thinking to use RTSP, but it is not too heavy for backup only solution, therefore FTP is the final choice and meet the requirement.


Setup

I need a hard disk for storage and an attached computer to work as FTP client to download data from the camera. NAS (Network Attached Storage) is the best solution but I have only one to backup my data, don't want to mess it up. Therefore, I use a single computer from my Odroid MC1, which is known as Odroid MC1 Solo - https://www.hardkernel.com/shop/odroid-mc1-solo/. It is equipped with 2GB RAM, ethernet port and USB port.


Hardware:-

  • Yi Outdoor Camera
  • Odroid MC1 Solo
  • External USB hard disk

Software:-

  • Hacked firmware for Yi Outdoor Camera
  • Odroid MC1 default operating system (Ubuntu 16.04)

First of all I formatted hard disk to ext4 because it will be operating under Ubuntu and the backup script is written in shell script. Formatted hard disk mounted to folder /mnt/hdd1. There are 2 shell scripts in this repository, core script is backup141.sh, you can edit the script to change constants to fit your environment:-

  • TOTAL_DAYS_KEEP : Total days of video recorded that you wish to keep in the harddisk, the script will delete old videos before it started to backup.
  • IP_ADDRESS : IP of the camera, I have configured it as fixed local IP in my router.
  • BACKUP_MAINFOLDER : main backup folder in the harddisk
  • BACKUP_SUBFOLDER : sub backup folder (it is not require to change unless Yi Camera change it's default folder)

I am using WGET to access to camera's FTP server (* while preparing this documentation, I just noticed that I hardcoded IP in the WGET, you may replace it with IP_ADDRESS constant instead).

In order to run the script in cron with proper documented log file with datetime as filename, I created another parent shell script - backupall.sh. This backupall.sh will run backup141.sh with proper datetime filename's log file, and it can add more core scripts for extra camera. Again, you can change the constants for your needs.

Command to add to cron:-

sudo -s
crontab -e
Then run script every hour:-
0 * * * * /bin/bash -c "/mnt/hdd1/backupall.sh" 2>&1


License

This application is developed by Season Wong. It is free software and licensed under the GNU General Public License v3.0 (GPLv3).



yi-outdoor-camera-1080p-backup-script's People

Contributors

seasonw avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.