Weatherunderground Upload Script / Timelapse Video

Forum for questions and support relating to the 1.30.x releases only.
Locked
camroidv27
Posts: 35
Joined: Tue Jun 15, 2010 6:18 am

Weatherunderground Upload Script / Timelapse Video

Post by camroidv27 »

NOTICE: Weatherunderground has stated they are pulling their webcam feature. This post now serves for auto FTP uploads for whatever reason. That and timelapse.

For those of you on 1.30.x who doubly use your DVR for both security, and posting an image up to Weatherunderground (all... 2 of you?) This script should be a little handy. I added it to my crontab to run every 5 minutes. The reason I used this script instead of pulling a JPEG from the zoneminder URL, is that I use a very low compression quality on streaming (but highest quality for saving files). I want to send WU the best quality I can, so I pull straight from zonminder's capture buffer. Hope it helps!

You will need to change the USER, PASSWORD, IMAGEFILE NAME (monitor number #), the ZMU command to select your monitor number #, and ADMIN Folder. You will also need to install jpegoptim (sudo apt-get install jpegoptim) so that your file sizes are pretty small.

FTP Upload Script (also includes the appending for timelapse)

Code: Select all

#! /bin/sh

#Setting up variables
REMOTE='webcam.wunderground.com'
USER='YOURUSERNAME'
PASSWORD='YOURPASSWORD'
FTPLOG='/tmp/ftplog'
IMAGEFILE='/var/www/html/Monitor#.jpg'
TIMELAPSEDIR='/dvr/wxcam/'
date >> $FTPLOG

#Capture image to the HTML folder, and then compress it
cd /var/www/html/
zmu -m 7 -U viewer -P viewer -i -v 
sleep 2
jpegoptim --size=50k $IMAGEFILE

#Upload file to FTP server
ftp -n -v -p $REMOTE <<_FTP>>$FTPLOG
user $USER $PASSWORD
put $IMAGEFILE image.jpg
quit
_FTP

#Append Image file to timelaspe video (Comment this out if you are not using it)
cat $IMAGEFILE >> $TIMELAPSEDIR/`date +"%Y%m%d"`.mpg

#Move image file to web directory (For other non FTP places to grab it?)
mv $IMAGEFILE /var/www/html/wxcam.jpg
 
exit 0
Final Product: https://www.wunderground.com/personal-w ... AZPHOEN381

Credit where credit is due: clipo suggested it on this post: viewtopic.php?t=15198

For timelapse videos, I concatinate JPGs into an MPG file, then convert that at the end of the day. Here is that end of the day script:

Code: Select all

#! /bin/sh

#Setting Up Variables
TIMELAPSEDIR="/dvr/wxcam"
FILENAME=$(date +"%Y%m%d")
cd $TIMELAPSEDIR
echo $TIMELAPSEDIR/$FILENAME.mpg

#Delete files older than two weeks
find $TIMELAPSEDIR* -mtime +14 -exec rm -f {} \;

#Convert file to make happy and small then delete the original
ffmpeg -y -i $TIMELAPSEDIR/$FILENAME.mpg -r 30 $TIMELAPSEDIR/$FILENAME.mp4
rm -f $TIMELAPSEDIR/$FILENAME.mpg
medic6578
Posts: 1
Joined: Tue Jul 14, 2020 2:47 pm

Re: Weatherunderground Upload Script / Timelapse Video

Post by medic6578 »

OK, I see the script how do I make it work in zoneminder. how do I get zoneminder to run the bash file, where do I install the file at? Lots of questions. like how do I get it to run every 60 seconds and so on...
also running as a docker on unraid.

thanks
Locked