Author Topic: Weathercam Timelapse with Overlay Weather data on a RP-4  (Read 815 times)

0 Members and 1 Guest are viewing this topic.

Offline rosegeek

  • Member
  • *
  • Posts: 31
    • Canton MI USA PWS
Weathercam Timelapse with Overlay Weather data on a RP-4
« on: April 25, 2020, 09:13:26 PM »
With a Pi-4 I set up a DIY timelapse with overlayed weather conditions.  I set up the Pi to run ffmpeg (free) to grab images from camera every 10 seconds, saved to USB drive, then pull conditions from meteobridge and overlay them on the captured image.  After an hour, I use ffmpeg to merge all the images (with overlayed conditions) into an mp4 timelapse.  Final step is to upload the timelapse(s) to my site.
Then I can set the Pi up headless, hidden away let it do it's thing 24/7.
Sample Timelapse:
http://www.weather.gloryhomemi.com/weathercam/cool_sunset_timelapse.mp4

I can share details if interested.
Davis VP2, Meteobridge TPLink, PWS linked to Rachio Sprinkler System.
http://weather.gloryhomemi.com
http://weatherconsole.gloryhomemi.com

Offline 92merc

  • BismarckWeather.net
  • Forecaster
  • *****
  • Posts: 972
  • BismarckWeather.net
    • BismarckWeather.net
Re: Weathercam Timelapse with Overlay Weather data on a RP-4
« Reply #1 on: April 26, 2020, 12:12:17 AM »
I would be interested in the details.  I'd likely do it via a Windows PC.

I have a web server already running on my Weather PC, so I'd probably serve them up that way.
https://www.BismarckWeather.net
Davis VP2, Cumulus, WeatherDisplay, Blitzortung, Bloomsky, Saratoga Scripts, NOAA Stream via PI

Offline Garth Bock

  • Table Rock Lake Weather
  • Forecaster
  • *****
  • Posts: 2266
Re: Weathercam Timelapse with Overlay Weather data on a RP-4
« Reply #2 on: April 26, 2020, 10:07:54 PM »
Awesome !

Offline josecmorales

  • Senior Contributor
  • ****
  • Posts: 251
    • Clima en Guayana
Re: Weathercam Timelapse with Overlay Weather data on a RP-4
« Reply #3 on: April 27, 2020, 10:57:05 AM »
Pretty awesome, would you mind to explain it? im insteresting!

Offline USAF_Pride

  • Member
  • *
  • Posts: 13
Re: Weathercam Timelapse with Overlay Weather data on a RP-4
« Reply #4 on: May 01, 2020, 06:30:49 AM »
Here is a github project for timelapse.  I've used this for building projects and is quite customizable:

https://github.com/Tom25/ipcam-timelapse

Offline wxthomson

  • Senior Member
  • **
  • Posts: 82
    • http://www.minnetonkaweather.com
Re: Weathercam Timelapse with Overlay Weather data on a RP-4
« Reply #5 on: May 01, 2020, 08:54:03 PM »
Very Cool!

Also interested.

Offline Bushman

  • Forecaster
  • *****
  • Posts: 7480
    • Eagle Bay Weather
Re: Weathercam Timelapse with Overlay Weather data on a RP-4
« Reply #6 on: May 01, 2020, 10:30:37 PM »
In Windows, you could use PowerShell or even a simple batch file to call FFMPEG.  The weather conditions overlay can be done with Imagemajick once you write out a text file.
Need low cost IP monitoring?  http://wirelesstag.net/wta.aspx?link=NisJxz6FhUa4V67/cwCRWA or PM me for 50% off Wirelesstags!!

Offline Wayne Orwig

  • Member
  • *
  • Posts: 18
Re: Weathercam Timelapse with Overlay Weather data on a RP-4
« Reply #7 on: May 03, 2020, 09:10:30 AM »
With a Pi-4 I set up a DIY timelapse with overlayed weather conditions. 

I can share details if interested.

I am interested in knowing how you overlayed the weather data onto the images.

Offline USAF_Pride

  • Member
  • *
  • Posts: 13
Re: Weathercam Timelapse with Overlay Weather data on a RP-4
« Reply #8 on: May 03, 2020, 01:06:49 PM »
With a Pi-4 I set up a DIY timelapse with overlayed weather conditions. 

I can share details if interested.

I am interested in knowing how you overlayed the weather data onto the images.

What camera are you using?

Offline Wayne Orwig

  • Member
  • *
  • Posts: 18
Re: Weathercam Timelapse with Overlay Weather data on a RP-4
« Reply #9 on: May 04, 2020, 12:17:40 PM »
With a Pi-4 I set up a DIY timelapse with overlayed weather conditions. 

I can share details if interested.

I am interested in knowing how you overlayed the weather data onto the images.

What camera are you using?

I have two cameras.
One is a simple USB camera on a RaspberryPI port, that I use 'fswebcam' once a minute to grab an image. I save the last ten images, and use 'convert' to make an animated GIF of those.
The other camera FTPs an image to my Raspberry PI web page.

I have the JSON with the data. I'm looking for a convenient way to overlay some of the text on the images. I currently have an HTML file, and cron runs 'chromium' to run the javascript in the html file and outputs the web page to a captured image. It works for a still image, but it is clunky.

http://hogmountain.asuscomm.com/image.png
« Last Edit: May 04, 2020, 12:23:25 PM by Wayne Orwig »

Offline rosegeek

  • Member
  • *
  • Posts: 31
    • Canton MI USA PWS
Re: Weathercam Timelapse with Overlay Weather data on a RP-4
« Reply #10 on: May 05, 2020, 10:05:05 PM »
For Win10 you can see the below post for more details how to implement.  Basically, use Win Task Mgr to trigger events (at startup to set camera streaming, each min to capture still, each hr to create timelapse).
https://www.wxforum.net/index.php?topic=39226.msg403562#msg403562
For Linux:  The Pi-4 is very capable SBC.  Process was similar to Win but instead of setting up RTSP (real-time streaming protcol) to run continuously and only capture frames every 10 seconds (uses 25% cpu) I setup an infinite loop to RTSP  a single image every 10 seconds - resulting in only 10% cpu load on average.  Trick is to make sure loop can finish within 10 seconds or else images will not be evenly spaced in timelapse that looks bad.  The Pi-4 can do it iwithin 4 sec's.
Overview:  This all runs in 4 bash scripts.
1) CRON triggers "Image_from_cam.sh" @restart captures jpg images from camera every 10 seconds - runs forever.  Stores in dir "timelapse" on USB drive.
2) CRON triggers "Overlay_text.sh" every minute:  reads meteobridge weather data (customizable) to "conditions.txt" file (current conditions from station).  Use ffmpeg to overlay conditions.txt to on all jpg images captured from 1).  Store in new dir to accumulate images for timelapse processing in next step (jpg_with_overlay).   Also save in another dir (long) for 8hr timelapse.
3) CRON triggers "TimelapseRTSP.sh" every hr:  Use ffmpeg to build mp4 from jpg's in dir jpg_with_overlay.  Then upload to site using SCP (secure CP).
4) CRON triggers "TimelapseRTSP_long.sh" every 8hrs:  Same as 3 except makes timelapse from dir "long"
Bonus:  in 3) and 4) added banner during sunset time "Sunset XX:XX" in Amber before sunset and in Red after.  Fun, not req'd!
Note:  CRONs have optional Log files for debug and history.  Scripts written to run from anywhere (no local dir references) - all point to USB drive.
Directory Structure:  See definitions in files to see.  Adjust to your choice.
Files attached: changed .sh to .txt for upload to this site.
Encouragement:  I'm no software guy (as you s/w guys will see from my "code").  I tried to make it somewhat fail-safe using all direct dir references.  Use at your own risk.  Enjoy the process of DIYing your own system.  Much more fun IMHO to learn instead of paying someone to do the same thing!  Happy to help you along the process.  However, you need to do your own homework!
« Last Edit: May 05, 2020, 10:17:26 PM by rosegeek »
Davis VP2, Meteobridge TPLink, PWS linked to Rachio Sprinkler System.
http://weather.gloryhomemi.com
http://weatherconsole.gloryhomemi.com

Offline Bushman

  • Forecaster
  • *****
  • Posts: 7480
    • Eagle Bay Weather
Re: Weathercam Timelapse with Overlay Weather data on a RP-4
« Reply #11 on: May 05, 2020, 10:48:04 PM »
Interesting workflow.  Why FFMPEG vs. ImageMajick CONVERT?
Need low cost IP monitoring?  http://wirelesstag.net/wta.aspx?link=NisJxz6FhUa4V67/cwCRWA or PM me for 50% off Wirelesstags!!

Offline rosegeek

  • Member
  • *
  • Posts: 31
    • Canton MI USA PWS
Re: Weathercam Timelapse with Overlay Weather data on a RP-4
« Reply #12 on: May 05, 2020, 10:52:53 PM »
With a Pi-4 I set up a DIY timelapse with overlayed weather conditions. 

I can share details if interested.

I am interested in knowing how you overlayed the weather data onto the images.

What camera are you using?
I use Reolink POE Camera RLC-410.  There is a HD and 5MP version.  I have both running in parallel on my Pi-4 in 16:9 aspect ratio.
Davis VP2, Meteobridge TPLink, PWS linked to Rachio Sprinkler System.
http://weather.gloryhomemi.com
http://weatherconsole.gloryhomemi.com

Offline rosegeek

  • Member
  • *
  • Posts: 31
    • Canton MI USA PWS
Re: Weathercam Timelapse with Overlay Weather data on a RP-4
« Reply #13 on: May 05, 2020, 11:07:07 PM »
Interesting workflow.  Why FFMPEG vs. ImageMajick CONVERT?
Prob can use either.  FFMPEG is much more in use though (about 3x).  I've used FFMPEG for RTSP single image, videos, overlay and timelapse - very stable and reliable although 100% command line.  What is your take?
Davis VP2, Meteobridge TPLink, PWS linked to Rachio Sprinkler System.
http://weather.gloryhomemi.com
http://weatherconsole.gloryhomemi.com

Offline Bushman

  • Forecaster
  • *****
  • Posts: 7480
    • Eagle Bay Weather
Re: Weathercam Timelapse with Overlay Weather data on a RP-4
« Reply #14 on: May 05, 2020, 11:51:25 PM »
I use a lot of D-Link cameras and they all create time-stamped photos so for me, overlaying with ImageMagick  is easier.  Plus you can pretty much script the whole thing in Python pon a PC rather than piece-mealing it.  But your solution(s0 is cool!
Need low cost IP monitoring?  http://wirelesstag.net/wta.aspx?link=NisJxz6FhUa4V67/cwCRWA or PM me for 50% off Wirelesstags!!

Offline Wayne Orwig

  • Member
  • *
  • Posts: 18
Re: Weathercam Timelapse with Overlay Weather data on a RP-4
« Reply #15 on: May 06, 2020, 10:53:45 AM »
Interesting workflow.  Why FFMPEG vs. ImageMajick CONVERT?

Does convert do text overlays? I have not found an option for that.
I never would have thought to use ffpmeg for text overlays.

Offline rosegeek

  • Member
  • *
  • Posts: 31
    • Canton MI USA PWS
Re: Weathercam Timelapse with Overlay Weather data on a RP-4
« Reply #16 on: May 06, 2020, 01:29:40 PM »
I use a lot of D-Link cameras and they all create time-stamped photos so for me, overlaying with ImageMagick  is easier.  Plus you can pretty much script the whole thing in Python pon a PC rather than piece-mealing it.  But your solution(s0 is cool!
D-Link have one wireless consumer grade camera.  Reolink has a wide selection (that's all they do).  I use a POE that is has excellent price:performance, no lag/stability issues that can occur with WiFi solutions.
Davis VP2, Meteobridge TPLink, PWS linked to Rachio Sprinkler System.
http://weather.gloryhomemi.com
http://weatherconsole.gloryhomemi.com

Offline Bushman

  • Forecaster
  • *****
  • Posts: 7480
    • Eagle Bay Weather
Re: Weathercam Timelapse with Overlay Weather data on a RP-4
« Reply #17 on: May 06, 2020, 02:02:56 PM »
Interesting workflow.  Why FFMPEG vs. ImageMajick CONVERT?

Does convert do text overlays? I have not found an option for that.
I never would have thought to use ffpmeg for text overlays.

Example: "convert img1.jpg -font helvetica -pointsize 9 -draw "text 167,554 'userName'" -pointsize 7 -draw "text 145,596 'userTitle'" img1b.jpg"  This is the way that Meteobridge does it too.
Need low cost IP monitoring?  http://wirelesstag.net/wta.aspx?link=NisJxz6FhUa4V67/cwCRWA or PM me for 50% off Wirelesstags!!

Offline USAF_Pride

  • Member
  • *
  • Posts: 13
Re: Weathercam Timelapse with Overlay Weather data on a RP-4
« Reply #18 on: May 07, 2020, 08:14:14 AM »
I use Dahua cameras and via an API, I can continually update the text directly on the camera (other cameras can do this as well). My workflow is as follows:
1. you get the weather information you want to display on the camera, and then send an HTTP call to the camera to set the text
2. Run ipcam-timelapse at selected intervals

If you wanted to, you could have 1 script via cron setting the weather information every minute, but have the timelapse pull it every 5. This way when you live view the screen, the current data is loaded.  The trick is to avoid lower end consumer cameras that don't allow API calls to set the text directly on the camera.

Offline rosegeek

  • Member
  • *
  • Posts: 31
    • Canton MI USA PWS
Re: Weathercam Timelapse with Overlay Weather data on a RP-4
« Reply #19 on: May 07, 2020, 10:22:53 PM »
Maybe we are getting away from original intention of the post.  Timelapse on a RP-4.  Yes, there are turn-key solutions and paid sites that create and host timelapse, but this is about a DIY project that allows for complete flexibility and creativity.  I never used a Rasp Pi before.  I learned it is quite capable of processing images and creating timelapse from multiple streams simultaneously.  It's been fun learning "how to" and I hope this post inspires others to do the same.
Davis VP2, Meteobridge TPLink, PWS linked to Rachio Sprinkler System.
http://weather.gloryhomemi.com
http://weatherconsole.gloryhomemi.com

 

anything