-
Notifications
You must be signed in to change notification settings - Fork 664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for modern libcamera Raspberry Pi camera stack #2425
Comments
The cameras I deal with are shown as v4l2-ctl --list-devices It may be related to RPi MMAL camera detection with legacy camera stack vs modern camera stack. Currently we use |
Hi the output of that command gives
vcgencmd get_camera and yes those commands are in the /boot/config.txt |
I have done some more reading, this thread is helpful.
|
I'm not sure how such infrared camera is commonly provided. E.g. based on However, you added it as MMAL camera, right? In this case But it would be interesting to know whether the cameras an be accessed via V4L2. It should show the large list of devices from your ... https://www.raspberrypi.com/documentation/accessories/camera.html#v4l2-drivers Actually to me it seems like MMAL is generally the legacy driver, V4L2 the one used with libcamera. Probably the Related issue on motion project: Motion-Project/motion#1434 |
Ah right, makes sense that it doesn't work as MMAL with modern camera stack. I'm wondering why the cameras are spread across so many After you switched to legacy camera stack, could you retry adding it as MMAL? Respectively does it show "supported" then in: vcgencmd get_camera ? |
I have now switched the configuration back to legacy stack. Under the MMAL selection the problem remains the same. The block remains blank and you can click OK but it never proceeds. Under V4L2 I have more options. I will try them out and update this post. The result of the command is: The result of "v4l2-ctl --list-devices" is: None of them work in motioneye. ;( |
Looks like we should add the device path to the camera name, for such cases where multiple devices have the same name, or one camera provides multiple devices for whatever reason. If
This is unexpected. We check for MMAL cameras via [[ $(vcgencmd get_camera) == 'supported=1 detected=1'* ]] && echo 'Yes it does!' || echo 'It does NOT!' |
Strange, are there any errors reported? journalctl -u motioneye |
Ah right, you are using the Python 2 version, which contains a nowadays buggy check for You could then also retry with the modern camera stack, adding the camera as V4L2 one. But the motionEye version of course doesn't affect the many /dev camera device paths, still now sure whether/how the camera is supposed to be accessed then. |
Is this Raspberry Pi OS 64-bit ( uname -m If it's 64-bit, you need to install the additional development headers, which can be skipped only on 32-bit RPi OS: apt install python3-dev libcurl4-openssl-dev gcc libssl-dev If it's indeed 32-bit, then assure that you followed the step to add piwheels as pip source, from where the pre-compiled printf '%b' '[global]\nextra-index-url=https://www.piwheels.org/simple/\n' | sudo tee /etc/pip.conf > /dev/null |
raspberry 4 I can only get a video (as MMAL Camera) if a switch on legacy support with raspi-config. Is there no way to use motioneye without legacy ? |
Not yet. Based on other reports the existing /dev/videoN devices cannot be added as V4L2 camera. I guess we'd need to add support for libcamera tools. |
Just to let you know I have managed to get it working on the previous version of Raspbian (Buster) through Python3. |
I'm having similar problems running Motion with the Arducam 12.3 MP HQ camera (IMX477) with automatic IR-cut filter using 32-bit Bullseye on a Pi Zero 2 W. I did not select the legacy stack in raspi-config, but when I run Motion with libcamerify, it DOES find and use the camera. Unfortunately, none of the mmalcam_params in the motion.conf file are being acted upon. I'm actually attempting to replicate an existing project that is already working. In the working project, I use an earlier revision of the same camera using Buster on a Pi Zero W, and that project properly responds to the mmalcam_params settings (see https://github.com/zizumara/LPRCam). I would use Buster for the new project, but unfortunately Arducam has changed the camera design so that it ONLY runs under Bullseye (at least that's what their product info says). The older revision of that camera is no longer available. |
I'm in the same boat with an Arducam IMX327. I need something to do motion detection and streaming. It's looking hard to find anything that supports libcamera. |
Actually, you may still be able to get the older version of 12.3 MP camera that runs with Buster. I was able to do that a few months ago and they sold me the older Buster-compatible camera for $20 more. Send your inquiry to sales@arducam.com. Note that if they do have it, the ordering process is a little confusing. They give you a product code that represents a $1 increment to your order, so you have to order 20 of these to increase your order by $20. Just make sure that you are very specific about wanting the camera that is compatible with Buster. I'm not sure if they are still doing this, but it may be worth a shot. |
Only catch is I have a box of 8 if these cameras already. I feel like there will be huge demand for motioneyes and similar projects to support libcamera as more people buy them. Would it work for motioneyes to listen to a stream on 127.0.0.1 established natively using a libcamera command? |
I use an easy workaround for the libcamera/motion/module v3 setup: |
Maybe using https://github.com/aler9/rtsp-simple-server/ can be useful to retrieve the camera flux and add a rtsp camera in motioneye ? |
Hello, I'm having an issue with the dev branch. Should the Dev python 3 branch support the Pi Camera Module 3? Thanks! |
No, otherwise this issue would be closed as completed. |
In my post above, I described an rtmp solution to make the cam module 3 working with motion. maybe you check that again. |
I did attempt it however I think the shell script dosnt terminate properly and it caused a crash before I could pkill it. So I sort of gave up on that method as it cost me an hour resetting the OS and installing all the other software like SNMP, ect. I appreciate the attempt to help. |
Uh, for shits and giggles, I asked Bard for a solution. MotionEye uses Motion as its backend for motion detection. MotionEye does not support libcamera directly. However, you can use a workaround to get MotionEye to use libcamera. The workaround is to use the To use the
The following instructions will show you how to install the
To install the
The following is an example of a wrapper script for the Motion application:
To configure MotionEye to use the wrapper script, you will need to edit the
Once you have made the changes to the
MotionEye will start using the wrapper script to start the Motion application. The Motion application will use libcamera to capture frames from the camera and check for motion. |
@raziel420
This is how it should work: apt install libcamera-tools
echo -e "#!/bin/sh\n$(command -v libcamerify) $(command -v motion) \"\$@\"" > /etc/motioneye/motion_wrapper.sh
chmod +x /etc/motioneye/motion_wrapper.sh
sed -i '/motion_binary/cmotion_binary /etc/motioneye/motion_wrapper.sh' /etc/motioneye/motioneye.conf
systemctl restart motioneye However, this does not solve the problem with the multiple |
The instructions above are from Bard, the google's chatgpt. |
Ah lol, I missed the re-read the first line. Okay this makes sense and is a perfectly example why one should never rely on any answer one of these AI bots give you for questions without explicit input. Great to shorten text, write summaries, stories and all this, but it does not give you correct/true answers based on research or logic, and it is not even meant to do so. @raziel420 sorry for thinking this was from you, I was already wondering whether it was mixed up with solution for other software or so 😄. But bringing this topic up probably leads to a solution, at least partly: https://motion-project.github.io/motion_config.html
Matches to what I wrote above (luckily). The other part we need to add in motionEye is to have another list of cameras based on |
I made a PR for implementing libcamerify support in MotionEye here #2765. Please bear with me as this is my first PR in a public open source project and I'm not a Pyhon developer. Anyways, this patch works for me and has been running since the 19. May without issues. |
Check this guys. |
Is there anything that people with access to hardware but not that much experience with python could do to help this move forward? Motioneye is still the best open source solution and it would be great to get past this hurdle. The various libcamerify tricks posted in various threads are unfortunately hacks that break down very easily. |
can anyone is having this error it is detecting camera `pi@raspberrypi:~ $ libcamera-hello --list-cameras
|
Hi,
I am using the latest version Raspbian (2022-04-04) and the latest version of Motioneye (0.42.1)
My infrared nightvision camera is connected to the internal Raspberry Pi camera port.
When I run libcamera-hello I can see that the camera is working
The devices are connected under Unicam /dev/media1 and ISP /dev/media0
The stream is 1296x972-YUV420
When I load Motioneye I cannot seem to add the camera in any way possible. I have tried all 20 or so devices in the list and none of them work.
The text was updated successfully, but these errors were encountered: