Looking for the best way to take a picture every hour on a few cameras

105437

BIT Beta Team
Jun 8, 2015
2,190
1,072
Anyone ever set this up? Best I can tell is that I'll need to create separate scheduled events to create a JPEG using the Queue JPEG post function. Thanks
 
Well so you already know you can do in your cameras WebUI under storage it seems.. Keep in mind that if you were to setup for a General Snapshot and later want to pull a few images it will fail after the first image until after the wait time is over.. At least that is how it works for me.. So for me. Making a Python script is better option. Leave your camera setup for 1 second images that it was setup for and when you start this script it will pull an image I setup for 4 different cameras I don't know if they were all the same password so I setup for making it command each camera change name and password to meet your needs and with this script it will pull an image every hour. Again can change to meet your needs.

Normal script. Windows 11 script will be below the first script if you are using Win11..

Python:
import requests
from datetime import datetime
import time

CAMERAS = {
    "cam1": "http://user:[email protected]/cgi-bin/snapshot.cgi",
    "cam2": "http://user:[email protected]/cgi-bin/snapshot.cgi",
    "cam3": "http://user:[email protected]/cgi-bin/snapshot.cgi",
    "cam4": "http://user:[email protected]/cgi-bin/snapshot.cgi",
}

def capture_snapshot(name, url):
    try:
        response = requests.get(url, timeout=5)
        if response.status_code == 200:
            filename = f"{name}_{datetime.now().strftime('%Y%m%d_%H%M%S')}.jpg"
            with open(filename, "wb") as f:
                f.write(response.content)
            print(f"Saved {filename}")
    except Exception as e:
        print(f"Error capturing from {name}: {e}")

while True:
    for name, url in CAMERAS.items():
        capture_snapshot(name, url)
    time.sleep(3600)  # wait 1 hour

If you want for Win11..

Python:
import os
import time
import requests
from datetime import datetime

# Example camera URLs (replace with yours)
CAMERAS = {
    "cam1": "http://user:[email protected]/cgi-bin/snapshot.cgi",
    "cam2": "http://user:[email protected]/cgi-bin/snapshot.cgi",
    "cam3": "http://user:[email protected]/cgi-bin/snapshot.cgi",
    "cam4": "http://user:[email protected]/cgi-bin/snapshot.cgi",
}

SAVE_DIR = "snapshots"
os.makedirs(SAVE_DIR, exist_ok=True)

def capture_snapshot(name, url):
    try:
        now = datetime.now()
        timestamp = now.strftime("%Y-%m-%d_%H-%M-%S")
        date_folder = os.path.join(SAVE_DIR, now.strftime("%Y-%m-%d"))
        os.makedirs(date_folder, exist_ok=True)

        filename = os.path.join(date_folder, f"{name}_{timestamp}.jpg")
        response = requests.get(url, timeout=10)
        if response.status_code == 200:
            with open(filename, "wb") as f:
                f.write(response.content)
            print(f"Saved snapshot: {filename}")
        else:
            print(f"Failed to get snapshot from {name}")
    except Exception as e:
        print(f"[{name}] Error: {e}")

while True:
    print(f"Capturing snapshots at {datetime.now()}")
    for name, url in CAMERAS.items():
        capture_snapshot(name, url)
    print("Sleeping for 1 hour...")
    time. Sleep(3600)
 
I had about 10 cameras saving snap shots on version 5.0.
I crashed my system once with an Updated version of BI, when the default became " continous" over riding my settings of every ten min or so.
Had to catch it before crashed several times, to switch off that " continous" .jpg setting... then @wittaj told me about substreams and I quit using .jpgs for that system at that Condo.

Something most people might not run into....but throwing out there as a thing...
View attachment Recording 2025-05-26 145404.mp4
 
Last edited:
  • Like
Reactions: 105437
Be aware when pulling snapshots directly from cameras:
  • The quality of the snapshot may be configurable in the camera's web interface, and will significantly affect the image file size. It can potentially be significantly higher quality than you could get from snapshotting the H.264/H.265 video stream (at the cost of being a rather large jpeg file).
  • It may have better or worse contrast than pulling it from Blue Iris. IP cams get really sloppy with converting to or from the "limited RGB" color space where only values from 16-235 are used instead of the full range 0-255. I've seen cases where the camera-provided jpeg snapshots provided noticeably different contrast than the video stream.
 
  • Like
Reactions: Flintstone61
jeez, i copied samplenhold 's Hourly folder. but i created it thru by selecting Aux5 and then have it point to a new folder using default BI steps. Then it wanted to repair regen the DB.
I think if I had just made a new folder called hourly inside Windows explorer and point to it, maybe it wouldn't have had a tantrum with regen the DB.
In other news I got off my ass and reterminated the color4k 180 cable with a non-pass thru Klein and its online again....grrr,