Balena Cam / Raspberry P - V4L: can't open camera

Noob here so please be gentle.

I’m trying to get my streaming camera project running. I’m using a RaspberryPI Zero W with a picam. I had the camera running on V4L and rasbian buster so I know that the hardware is working. Using tutorials I’ve switched to BalenaOS + Balenacam. However I am getting two errors at the moment and can’t seem to figure out how to fix this issue:

VIDEOIO ERROR: V4L: can’t open camera by index 0

Failed to open default camera. Exiting…

Thanks in advance.

Hi there. On the RaspberryPI you need to set a couple of config options to use the camera. You can find them here: https://www.balena.io/docs/learn/develop/hardware/i2c-and-spi/#raspberry-pi-camera-module.

Let me know if that works for you.

Hey thanks for the response. So I think you’re talking about:

gpu_mem=128
start_x=1

which I thought were both set via the fleet commands?

https://imgur.com/02V3XC1

It all looks correct.

What version of balenaOS are you running? Is there any other app logs that might be useful? If you enable support access to the device and send us a link we can take a look and see what might the problem.

Hey @ereski I granted support for 1 day, I can grant for longer if needed!

Thank you

Hey @Polytrigon, I just sent a private message to you to ask for the UUID of this device so we could investigate further. Please reply to my private message when you have the chance.

Hi @Polytrigon,

After checking the configuration on the device that you granted us access to, I saw that the RESIN_HOST_CONFIG_gpu_mem is set to 16.
According to the balenaCam instructions you should delete that configuration variable and only leave the BALENA_HOST_CONFIG_gpu_mem_XXX ones defined.
Can you try that and check whether that fixes the VIDEOIO error?

Let me point you to that section of the balenaCam readme:

Kind regards,
Thodoris

I disabled the resin host gpu memory, doesn’t look like it fixed it.

Hi @Polytrigon,
After checking you device configuration I saw that RESIN_HOST_CONFIG_gpu_mem is set to 16.
As per the instructions of the balenaCam project, I would suggest you to try deleting that configuration variable and only leave the BALENA_HOST_CONFIG_gpu_mem_XXX variants defined and check whether that fixes the issue.

Let me point you to the balenaCam instructions that I mentioned above:

Kind regards,
Thodoris

Hi @Polytrigon,

can you re-enable support access for the device?

Best regards,
Marios

Hello again,

after going through a similar issue which you can find here: Slimdown balenaOS for smaller hosts . The solutions that I mention are the same, assuming that your pi zero is probably running balenaOS version 2.32. So if you downgrade libraspberrypi-bin and uncomment this line https://github.com/balena-io-projects/balena-cam/blob/68310b0a9bbb2746c15a45dc97baace90fb44d16/balena-cam/app/server.py#L178 then balenaCam should work.

Kind Regards,
Marios