Getting a realsense camera working with balena-cam

Hi, I recently got help building pyrealsense2 on a pi and I’m now trying to make it work in balena-cam.

The first problem is that balena-cam is based on balenalib/raspberrypi3-debian:stretch-20190612, while I got pyrealsense2 working from balenalib/aarch64-debian:bullseye-build.
If I try to change the image balena-cam is based on, I get the following errors:

[balena-cam] Package libqtgui4 is not available, but is referred to by another package.
[balena-cam] This may mean that the package is missing, has been obsoleted, or
[balena-cam] is only available from another source
[balena-cam] E: Unable to locate package libjasper-dev
[balena-cam] E: Unable to locate package libilmbase12
[balena-cam] E: Unable to locate package libopenexr22
[balena-cam] E: Package 'libqtgui4' has no installation candidate
[balena-cam] E: Unable to locate package libqt4-test

Can you help?

Hi,

did you try to add

RUN apt-get install [...packages from the error]

too after you changed the base image?

The build stage that fails is already RUN apt-get update && \ apt-get install -yq \ [a whole bunch of packages including all the ones in the errors]

I tried removing the missing packages from the apt-get to see what happened, and after I also removed all the version requirements on the pip install commands and remove the --index-url https://www.piwheels.org/simple, it built and I have a site at https://83996478ceba76a42ec8e25410ba3438.balena-devices.com/ where I just get spinning dots. (I have also changed server.py to use pyrealsense, tomorrow I plan to stuff it full of debug logging.

I also needed to import numpy in server.py, and follow the balena cam instructions for viewing in firefox, it works now!
n.b: “config:about” in the instructions for viewing in firefox should actually be “about:config”

While it’s working, I have about 2s of lag on the video, does anyone know of a way I could speed it up?

Here are the files I have modified from balena-cam:
docker-compose.yml.txt (567 Bytes)
Dockerfile.aarch64.txt (1.9 KB)
server.py.txt (9.5 KB)