so I use ffmpeg to grab the screen capture of an rtsp feed and save it to a jpg image.
I process a camdataT.txt with cumulusmx and save to camdata.txt (used to show values on the final image)
Code: Select all
Temp: <#temp>°C • Pressure: <#press> hPa • Hum: <#hum>% • Wind: <#wspeed> mph <#currentwdir> • Rain: <#rfall>mm • UV Index: <#UV> • SolarRad: <#SolarRad> W/m² • CloudBase: <#cloudbase>
I then use imagemagick's "convert" to add overlays and text to top and bottom of image and save it to another jpg that is used on my website.
this script is run every minute and updated text applied too to final image. you dont have to run every minute but I do. thats just called using a cronjob.
Code: Select all
*/1 * * * * /share/scripts/webcam.sh
webcam.sh file below.
all files, paths, IPs etc are fictitious
Code: Select all
#!/bin/sh
#
#set variable yday to be like 20100208
#
#tday=$(date -d today +%Y%m%d%H%M%S);
#stamp=$(date '+DATE: %d/%m/%y%nTIME:%H:%M:%S');
tday=$(date +%Y%m%d%H%M%S);
#stamp=$(date +%Y%m%d);
# get weather image
/opt/ffmpeg/ffmpeg -rtsp_transport tcp -i rtsps://192.168.1.22:5678/hYHihPWuoJzS5W0A?enableSrtp -vf scale=2688:1512 -frames 1 /share/weather/sky1.jpg -y;
# next 2 lines add weather info
testdata="$(/bin/cat /share/wx/camdata.txt)";
testdata1=`date +"%A %d-%b-%Y %R %Z"`;
# use Convert to add WX values and date etc to the image
/share/convert -fill RoyalBlue4 -draw "fill-opacity 0.4 rectangle 0 0 2688 30" \
-fill red -draw "fill-opacity 0.6 rectangle 0 31 2688 33" \
-fill RoyalBlue4 -draw "fill-opacity 0.7 rectangle 0 1482 2688 1512" \
-fill red -draw "fill-opacity 0.6 rectangle 0 1479 2688 1481" \
-fill white -pointsize 22 -font /share/ZFS21_DATA/db_backup/script/arialbold.ttf -draw "text 10,20 'Conlig Weather Station: $testdata1 • www.conligwx.org'" \
-fill yellow -pointsize 22 -draw "text 10,1507 '$testdata'" /share/wx/sky1.jpg /share/wx/skywebcam.jpg;
# convert image.jpg to 150kb for WUnderground
/share/convert /share/wx/skywebcam.jpg -define jpeg:extent=150kb /share/wx/image.jpg;
image is available 24/7 but its night time here so image is not worth showing at present. I'll post an image tomorrow of the final image.
you can also use ffmpeg to create a timelapse video is your want to with another script I have.