BI too sensitive to packet loss

dustball

n3wb
Joined
Jul 24, 2019
Messages
3
Reaction score
2
Location
USA
I have a 4 camera system, and three of them are hard wired and work great.

One is a crappy WiFi camera, and it is recording the least important area. The problem is it is far away enough from the access point that it has a lot of packet loss.

When using iSpy, the result would simply be piss poor frame rate - somewhere around 1fps. Which was totally fine for that camera.

But BI doesn't want to play ball at all with this camera. No Signal.

Any ideas?
 

dustball

n3wb
Joined
Jul 24, 2019
Messages
3
Reaction score
2
Location
USA
I came up with a better solution. I wrote a Python script to fetch the image with an appropriate timeout, and save the file locally.

Code:
import urllib.request, urllib.error, urllib.parse
from shutil import copyfile
import time

# Your camera URL here
url = 'http://192.168.0.18/IMAGE.JPG'

while True:

    try:
        start_time = time.time()

        filedata = urllib.request.urlopen(url, timeout=5) # adjust timeout accordingly
        datatowrite = filedata.read()
    
        with open('image-cache.jpg', 'wb') as f:
            f.write(datatowrite)
      
        copyfile("image-cache.jpg",'image.jpg')
  
        elapsed_time = time.time() - start_time
        fps = 1/elapsed_time
  
        print ("OK, "+ str(round(elapsed_time*10)/10) + " sec, "+str(round(fps*10)/10)+" fps")
 
    except KeyboardInterrupt as e:
        exit()
 
    except Exception as e:
        print ("Error, retrying")
And then run one more Python process to serve the file to BI:

Code:
python -m http.server 8000
And then in Blue Iris you can fetch the image with:

Code:
http://localhost:8000/image.jpg
Tip: use the max frame rate setting ("Video" tab in camera settings) in Blue Iris to something low enough otherwise it will refetch the same unchanging image unnecessarily. You want it to roughly match whatever the script can pull from the camera.

Problem solved. Maybe this will be useful for others.
 
Last edited:
Top