Loading

Expect the Unexpected

Expect the Unexpected

Living in Alaska, I've learned to expect the unexpected.  Weather can change in an instant, and when it does it's nice to stop and watch the show.  Luckily, I get to share it with you because of my installation of Frigate.  I am currently developing a front-end interface called fEVR, frigate Event Video Recorder.  One piece I have been missing for some time is the ability to select a date and time to playback video easily.

Last night gave me the motivation to write a small piece of code that will help in that process.  I wanted to share a clip of the hail and thunder with family and friends, so I wrote up a quick python script that will eventually make its way into fEVR.

#!/usr/bin/python3
from datetime import datetime
import argparse

def getFrigateVodUrl(start,stop,url,camera):
    startT = datetime.strptime(start, '%m/%d/%Y %H:%M:%S')
    startTS = int(startT.timestamp())
    endT = datetime.strptime(stop, '%m/%d/%Y %H:%M:%S')
    endTS = int(endT.timestamp())
    vodURL = f"{url}/vod/{camera}/start/{startTS}/end/{endTS}/index.m3u8"
    return vodURL

def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('start',type=str,help="VOD Start Time ex: 06/09/2022 01:00:00")
    parser.add_argument('end',type=str,help="VOD End Time ex: 06/09/2022 01:30:00")
    parser.add_argument('url',type=str,help="Base URL of frigate ex: http://192.168.2.240:5000")
    parser.add_argument('camera',type=str,help="Camera Name")

    args = parser.parse_args()
    print(getFrigateVodUrl(args.start,args.end,args.url,args.camera))

main()

I named the file fvod and stashed it in my ~/bin directory and ran the following command:

localadmin@localhost:~> fvod "06/09/2022 01:24:00" "06/09/2022 01:24:30" \
"http://192.168.2.240:5000" "driveway"

http://192.168.2.240:5000/vod/side/start/1654766640/end/1654766670/index.m3u8

I eagerly copied and pasted the URL into VLC.  Huzzah!  It worked!  I quickly captured the video and saved it to hail.mp4 which I can now share with family and friends!

0:00
/
Thunderstorm rains down hail in Palmer, AK on 6/9/2022

Yes, the video was from 1:24 AM.  Yes, it was still twilight out.  It looks this bright because of my Wyze V3 camera.  During summertime, I can leave the night vision off and still pick up everything in color.

Alaska Daily News reported a hotel in Palmer caught fire after being struck with lightning during this storm.