Code Monkey home page Code Monkey logo

unifi-timelapse's Introduction

UniFi-Timelapse

Create time lapse video from UniFi camera.

This was never developed for public consumption, so it’s messy with not much error checking. If someone wants to fork it, clean it up, and keep it up to date, please be my guest. Consider the License public domain, so you can do anything you like with the code.

Install

Log into the camera and enable "Enable Anonymous Snapshot", then go to http://camera.ip.address/Snap.jpeg and check you see a still image. If not, fix what’s wrong as nothing else will work.

Place the bash scripts into a directory of your choice. Edit unifi-timelapse.sh

Change the below to a directory of your choice. All jpeg images will be stored here under the camera name.

SNAP_BASE="/mnt/hgfs/Disk2/UniFi-Snaps”

Change the below to the IP address and names of your cameras

CAMS["Front Door"]="http://192.1.1.1/snap.jpeg"
CAMS["Back Door"]="http://192.1.1.2/snap.jpeg"
CAMS["Driveway"]="http://192.1.1.3/snap.jpeg"
CAMS["Back Garden"]="http://192.1.1.4/snap.jpeg"

Now check the script will save snaps :-

unifi-timelapse savesnap "Front Door" "Driveway"

That should save a still image to the directry lieted in the SNAP_BASE variable. If it worked setup a cron job to execute that script every time you want to save an image. This example is crontab to save an image every minute

*/1 * * * * /path/to/script/unifi-timelapse savesnap "Front Door" "Driveway"

Then every time you want to make a video, simply execute

unifi-timelapse.sh “camera name” today

That will create a time-lapse of all todays images. Options are today yesterday all file hopefully that’s self explanatory. The file option should be a text file with a list of the images you want included, one per line.

unifi-timelapse's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

unifi-timelapse's Issues

Rendering video

Hi!

Got it working taking snapshots. Nice code. I dont got the video part working. ...pathto bash.sh "camera" today returns
ln failed to create symbolic link ...../00001.jpeg

I changed directory to:
SNAP_BASE="/mnt/UniFi-Snaps"
and changed camera IP

In folder UniFi-Snaps I have the folders "Basement", "Fram", "Pool" and "timelaps"
I have mounted a WindowsSMB Share

MacOS Montery Date fix for your script

I am making your script work with Mac OS Montery, the date command you use to create the video for yesterday doesn't work. The correct line of code for it is as follows.

The commented line below is *nix, the line below that is the fix for MacOS Montery

ls "$snapDir/"date '+%F' -d "1 day ago".jpg | sort > "$snapFileList"

 ls "$snapDir/"*`date -v '-1d' '+%Y-%m-%d'`*.jpg | sort > "$snapFileList"

Works a treat wanted to let you know. I use UI stuff here at my house and rather than put this on my Cloud Key Gen 2+ I use launchctld to schedule this for me. to create a video for today worked just fine but when I tried to create one from yesterdays images it threw an error.

Thanks for a great script, I hope this helps someone else.

Doug Lewis
KF0EZB

Unable to create video due to symlinks not being supported on SMB

I updated this script to use an SMB mount to my NAS to store and process the video creation process.

When creating a video I was getting: ln: failed to create symbolic link './000418.jpg': Operation not supported

The fix to this issue is adding ,mfsymlinks to the end of the mount command

https://docs.microsoft.com/en-us/azure/storage/files/storage-troubleshoot-linux-file-connection-problems

This isn't really this scripts issue, but figured I would put this in here for others running into this issue not wanting to store all of the images locally (I have this running on a RaspberryPi)

How to use the file option

Would the following be the correct syntax?

sudo unifi-timelapse.sh createvideo "Mail Box" list.txt

If so, where should the text file live? Where the script is located (/usr/local/bin) or where the images are being saved ('/media/disk1/UniFi-Snaps/Mail Box')

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.