BI too sensitive to packet loss

Discussion in 'Troubleshooting' started by dustball, Jul 25, 2019.

Share This Page

  1. dustball

    dustball n3wb

    Joined:
    Jul 24, 2019
    Messages:
    3
    Likes Received:
    1
    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?
     
  2. IAmATeaf

    IAmATeaf Getting comfortable

    Joined:
    Jan 13, 2019
    Messages:
    662
    Likes Received:
    315
    Location:
    United Kingdom
    Ditch the camera or put in a repeater near the camera to improve the signal?
     
    looney2ns likes this.
  3. dustball

    dustball n3wb

    Joined:
    Jul 24, 2019
    Messages:
    3
    Likes Received:
    1
    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: Jul 25, 2019
    IAmATeaf likes this.