-
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
Implement libcamerify support for motion binary #2765
base: dev
Are you sure you want to change the base?
Conversation
Implement support for libcamerify wrapper
Please advice what's the next step here for me or if it's only resting on approval. |
Just to be sure: This is really only for Raspberry Pi and software which uses the legacy RPi camera API while the modern libcamera driver/API + KMS is enabled, right? We should make that pretty clear in the config file + add instructions or a link about how to actually install libcamerify. Optionally a page in our wiki + a link to it in the config file. |
Co-authored-by: MichaIng <micha@dietpi.com>
Co-authored-by: MichaIng <micha@dietpi.com>
Co-authored-by: MichaIng <micha@dietpi.com>
Yes, this is only for RPI. Any new camera released by Raspberry will only be supported the new libcamera APIs. Motion will probably never support libcamera. That's what the new MotionPlus is for, and it supports libcamera. I'm using it for streaming my 3d printer with a RPI-cam v3 and it's snappier. As long as MotionEye uses Motion we need to use libcamerify as a backwards compatibility layer. Alternatively there are workarounds like creating a local ip-camera and use it as a source in MotionEye which is pretty cumbersome. The other option is to use the "MOTION_BINARY" config to run a script using the libcamera wrapper but then MotionEye struggles to restart Motion (some PID issue). |
@MichaIng I have updated the sample config file with your suggestions. I do not have permission to edit the Wiki. |
Any idea when this will be released? |
Does anyone have a guide about how to set this up from scratch? I have a Raspberry Pi 4 and one of the new camera modules. I'm a bit surprised that MotionEye doesn't support this - then found this issue around libcamera, but I have no idea how make it work when it's just in a PR (and this PR mentioning the need for manually compiling MotionEye, without instructions about what/how to compile.). |
I think this is waiting for someone to test it, and it would be great if you @joknjokn could do that. I don't remember if there are instructions anywhere on how to compile MotionEye after cloning the repository with git or Github CLI tools, but I think you should be able to use the instructions for running the yet-unreleased dev branch which are given here: https://github.com/motioneye-project/motioneye/tree/dev#installation The rest of the instructions should work as-is as long as you have any possible dependencies needed by libcamerify already installed. |
Hi :) Is this still worked on? I tried installing from scratch but the errors of motion remain.
the interesing part is if I stop motioneye and just call "libcamerify motion" I do not get any errors except for the fps setup:
But the grey screen with "unable to open video device" is still present... |
@Schattenruf I think the reason for that is motion in that case using a different config file than it does when commanded by MotionEye:
With MotionEye, Did you try running code from this PR, or just current dev branch? |
This PR to be exact. I tried to go to the old camera stack because vcgenmod posted "supported = 0 and detected = 0 and libcamera = 0". But after the switch i just got "supported = 1 and detected = 0 and libcamera = 1" but they grey windows stayed :( Edit: now libcamerify motion does not work as well... |
OK, so I uninstalled motioneye, used
|
Oh shoot, I seem to have not read the PR changes fully, since I only now realise that there's still no version of Motion that would work ok with libcamerify 😢 The comment in https://github.com/motioneye-project/motioneye/pull/2765/files#diff-38b4df7bd750714ac86810a7505d371b466d8a5c9b5cdfa51c7454824a48cf62 suggests that recompiling Motion would be the only way to get that part working, which is the basis of the solution this PR proposes.
(1b3a8262fef5d6d1c249a726957b1aa607f39196 is the current HEAD of master, the fix is a bit earlier in b760d0be48c2ebf9fc0ff2b991cd9c80e07ca502 but I chose 1b3a826 just to make sure any possible related hotfixes are included) Anyway, after recompiling motion, you'd need to add the following line in
And while you are editing that file, also change the line starting with
so that we get better visibility to what is happening. I really hope I didn't goof up anything above since I have no such camera to test myself... 😬 😅 |
I went with libjpeg9-dev.
Had to install git (surprised it wasn't already)
I have a |
Maybe I should have cross-checked with Motion projects build instructions given the long time that had passed since jasaw's comment... 🤦 There the required packages list is a bit longer (and includes e.g.
Other than that, the previous instructions seem to match. So please try to install the rest of the needed packages and start again from |
Having done this the results are the same, no MMAL camera option, no functional V4L2 camera. Let me know what logs you'd want. |
edit: No I didn't goof up the instructions, actually that libcamerify line was just currect based on the modification made in this PR to the example one. @yaomtc Please post the output of @strips Do you have ideas on debugging this? How are those "libcamerified" cameras supposed to be shown in ME? I supposed they will not show as MMAL even with this, do they, since this doesn't seem to change the code for detecting cameras? |
@yaomtc the log shows lack of mention of finding
Please also check if
After installing the package, re-check existence of |
I have that line at the end of the .conf file, and
|
I'm now out of ideas. @strips do you have ideas on why the debug logging (see the gist linked in above comment) isn't showing anything related to libcamerify even though the binary should be available and the config has the |
Sorry for not chipping in but I kind of gave up after my RPI crashed and I have to reinstall. I'm not sure I will even try to use MotionEye again for any new camera that only supports libcamera. MotionEye uses Motion and Motion will never have libcamera-support. Thats why the Motion-guys (I think) are making MotionPlus. MotionEye should be changing over to MotionPlus to support any new cameras on Rasperry Pi. But as this is a part time hobby for most people I don't think it will happen any day soon. If I had just spent all that time trying to get this to work working extra at work I could have bought my self multiple dedicated standalone wifi-cameras. But not sure if it would be as "fun" :) Back to your question, Sorry I don't remember all the steps I did in rebuilding. |
@strips ok, that's fair enough. I haven't even looked at MotionPlus, but if the interface is not like with Motion (even if it was nicer for integration in code level) then it'll probably be too much work, at least given the current amount of work the current maintainers are able to put in this project. But still, I'd expect the changes in this PR should work, I assume. At least they've worked for you, right? 😃 |
@zagrim It did work but it also crashed sporadically. It could work for a few hours or a few days. I think it could not restart itself after some kind of event like it should. I think it might be something with a PID. |
I think I tried all the cams in the list and one worked. Teflon memory. |
Hi, I never got to try your branch, but I somehow just now managed to get my camera working with MotionEye. I have the Raspberry Pi HQ camera with IMX477 sensor. I've spent roughly 6 hours just doing random things I found in github-threads here and there. I have this:
This is approximately what I did:
Also:
The output of the log after I saw the camera working in motioneye:
As said - I don't know what I'm doing, but I hope maybe some of you, who know more about this, may be able to figure out how/why it ended up working. |
For better support for newer libcam-only cameras on RPI. Please bear with me as I'm not a Python developer.