When I was following Kyle’s guide I tried to use same camera library as he recommended (raspistill) but it didn’t work. Actually - none of them worked except Libcamera. Why - I’ve no idea, but I was happy that something worked. My guess is that perhaps this has something to do with me using the CM4 on top of the IO Board and not a regular plain Pi. I was sad that only libcam worked as it doesn’t have a stream capability but it is what it is.
But today when I tried to record a timelapse and it seem to be recording, but when I press generate it give an OK and a green status, but when I connect to the folder via remote connect I see 3 files:
still
timelapse
timelapse_video
All 0 bytes.
Mykodo logs show:
File "/var/mycodo-root/mycodo/devices/camera.py", line 488, in camera_record
set_user_grp(path_file, 'mycodo', 'mycodo')
File "/var/mycodo-root/mycodo/utils/system_pi.py", line 683, in set_user_grp
os.chown(filepath, uid, gid)
FileNotFoundError: [Errno 2] No such file or directory: '/home/username/Mycodo/cameras/0f118fee-5abd-438e-b6f3-fe039efdcf73/timelapse/Timelapse-1-1-2024-05-21_17-33-40-img-00016.jpg'
2024-05-22 01:03:44,368 - ERROR - mycodo.devices.camera - No image was created. Check your settings and hardware for any issues.
2024-05-22 04:03:44,148 - ERROR - mycodo.devices.camera - Exception raised in 'camera_record' when setting user grp: [Errno 2] No such file or directory: '/home/username/Mycodo/cameras/0f118fee-5abd-438e-b6f3-fe039efdcf73/timelapse/Timelapse-1-1-2024-05-21_17-33-40-img-00022.jpg'
Any tips on how to fix camera to use other libraries or how to fix the timelapse issue?
Kyle’s guide is now a little outdated.
It has nothing to do with the CM4 and the I/O board, it’s not a hardware issue, it’s a firmware/software issue.
First of all, you are using the HQ cam, so it will create very large image files that take up a lot of memory and disk space and put a tremendous strain on the Pi’s system resources. Why would you need to stream video from a mushroom or hydroponics tent? Plants and mushrooms do not move, so streaming video is not really necessary. Even on a Pi4 with 8gb of ram, and especially when using the HQ cam, you will still only be able to stream 1 or maybe 2 frames per second in Mycodo, and even then it will eventually crash, so it’s not recommended anyway. If you are shooting timelapse vids, it uses a LOT of system resources on the Pi to try to compile that video, especially when you are shooting hi-res images with the HQ cam and especially when it is also running Mycodo while trying to compile the video. The best way to get good quality time lapse videos is to shoot still frames using the Mycodo still option, and then download all those stills to your desktop computer and then use a video-editing app like KDENLive to compile the timelapse video.
As for the software, raspistill and picamera are no longer supported and no longer work on any of the new Raspberry Pi OSes. Since the latest release of Bullseye, Libcamera is now the default camera stack that is installed when you setup a new SD card. It will automatically detect which camera you have connected to the Pi and install the appropriate drivers for that camera. There are no longer any options or support to setup the old Legacy camera stack from raspi-config.
If you want to use the old, and now un-supported, Legacy camera stack, you will have to manually build (recompile) your own custom OS installation… OR you can download an older OS that still has support for the Legacy camera stack, like Buster. The problem with that is you will not be able to run upgrades as it will most likely break the camera functionality as well as cause other issues with any apps you want to install, like Mycodo.
We are all now stuck with what the OS devs have forced us to use. I still can not understand why they decided to replace the fully functioning Legacy camera stack with the incomplete and frustrating Libcamera stack. This is what they call “progress”.
Raspistill was software designed for Raspberry Pi OS 10 (Buster) and prior. RPi OS 11 (Bullseye) and newer have deprecated raspistill and are using libcamera. This is 100% the oprating system you install, not the hardware. If you install RPi OS 10, you can use raspistill. If >= 11, you must use libcamera or face ever increasing hardships to use raspistill as it becomes more obsolete every day.