I have a few IP cams, mainly Foscams. Some of them have an SD slot some don't, and that's where the problem starts, as the ones with the SD slot can do that, but the others don't unless I define an FTP folder, which I do not have.

I need an app to take a screenshot of all the defined cams automatically in the background every n interval and saves them locally. My PC will be running 24 hours.

I do not mind if it's a win32 app or a Windows 10 UWP app.

1 Answer 1


OpenCV can do this for you with a little help from python & numpy from this gist you can create an ipCamera class:

import base64
import time
import urllib2

import cv2
import numpy as np

Examples of objects for image frame aquisition from both IP and
physically connected cameras
 - opencv (cv2 bindings)
 - numpy

class ipCamera(object):

    def __init__(self, url, user=None, password=None):
        self.url = url
        auth_encoded = base64.encodestring('%s:%s' % (user, password))[:-1]

        self.req = urllib2.Request(self.url)
        self.req.add_header('Authorization', 'Basic %s' % auth_encoded)

    def get_frame(self):
        response = urllib2.urlopen(self.req)
        img_array = np.asarray(bytearray(response.read()), dtype=np.uint8)
        frame = cv2.imdecode(img_array, 1)
        return frame

# Section for physically connected cameras removed

Personally I would test the above with each of your cameras as they are to see if you need to make any tweaks to it. Then all you need to do is populate a list of instances with your list of cameras, and their username & password credentials, and grab & save a frame from each at whatever interval you choose into a suitable directory structure. Personally I would extend the above to give each instance a name, a save location, etc., and add a method to grab and save a frame in an appropriate format.

  • Free gratis & Open Source - Good!
  • Cross Platform - Can run on Windows 7-10, OS/X, Linux, you could even consider using a RaspberryPi with a storage device attached - Good!
  • Need to learn a bit of python but Python is a lot easier to learn than C/C++/C# and is "batteries included" - you don't need to go out and get, or pay for, any other tools - Good?
  • No GUI unless you add one yourself there are several good GUI tools for python - Maybe not so good!
  • Extensible - you could add code to alert you if there is more than a specified percentage change from the last frame, there are even examples on the web of how to use the same tools to detect person like objects in images, etc. - Could Be Very Good!

Disclaimer: The original code above was posted by Tristan Hearn to a github gist on on 12 May 2013 I cannot take credit for writing it myself.

  • 1
    nice! but the code lacks logic for taking screenshots on a given interval. The code basically takes screenshots. I think I can figure this out in python or simple use the same library via c# which I know better. Dec 24, 2015 at 8:39
  • @HeidelBerGensis - I was trying to point in a good direction rather than to write the application for you - I charge for that - if you are happier with C# emgu.com/wiki/index.php/Main_Page may be of help (the python bindings ship with OpenCV. Dec 24, 2015 at 8:45
  • thanks mate. I like this solution actually, I wasn't complaining :) I love challenges. Dec 24, 2015 at 8:47
  • Have a good holidays! Dec 24, 2015 at 9:16
  • 1
    @Hack-R Most IP cams use one of the standards, (the most common variant is to use one of the streaming formats that is normally wrapped inside of MPEG containers), and with a little bit of work you can normally get OpenCV working with them. Dec 11, 2016 at 18:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.