A couple months ago I made a Python-Vue app ( Flask PyWebCamWebMonitor ) for controlling webcams(live view/record/stream) attached to a Linux host.

It’s pretty straight forward you use pip3 to install it then you install it as a system service or you start it manually with a command that is registered on the system automatically after you installed the python package.

When I first released it I tested it on a Linux X86 host but my intention was to make the app work even on the smallest dev boards, so a few days ago I tried to install it on orange pi zero.

As expected I encountered some problems first, the problem is that installing NumPy which is a dependency of OpenCV which is a dependency of my app, was complicated because the NumPy was not available for arm devices and when you tried to install it from building it you ran out of memory and the kernel killed the building process, you can activate a swap, and increase your /tmp size to overcome these limitations but it is simple just to install NumPy from the APT repo with apt install python3-NumPy, that you don’t have to needlessly wait.

After I installed I tried to run the command pyWebCamMonitorCtl start, which started the app but the app crashed after a few seconds, after some digging it seems there is a bug in the Flask_SQLAlchemy==2.4.4, I went to file a bug issue on GitHub but I checked first the latest dev branch, and I was it was patched so no reason to file a bug issue because probably it was already reported and patched, but unfortunately, the patch will probably come after 2.4.4 so I changed the dependency to >=2.4.4.

The bug was that it failed to create an SQLite DB on some systems when you passed an absolute path:

So I changed the line

        if not detected_in_memory:
            sa_url.database = os.path.join(app.root_path, sa_url.database)

To

        if not detected_in_memory and not os.path.isabs(sa_url.database):
            sa_url.database = os.path.join(app.root_path, sa_url.database)

After that, the pyWebCamMonitorCtl start worked but when I tried to log in it had an error making JSON from the object with the auth token, so I fixed that using decode(“utf8”) on the object before passing it to the jsonify() function.

After that no more problems, I added the changes in a new packet 0.0.14 so that if anyone tries to install it on a very small board in the future to encounter fewer problems.

PyWebCamWebMonitor Requirements

  • A Linux Distribution
  • FFmpeg program installed( it’s available in most distros, for example, Ubuntu apt-get install ffmpeg)
  • Some python packages
  • python > 3.6

You can find more on the Gitlab page here: https://gitlab.flashsoft.eu/python/flask-pyWebCamWebMonitor

Screenshots