Closed Qqwy closed 6 years ago
Hi @Qqwy! The challenge here is that picam
is highly coupled to the Broadcom MMAL API under the hood, which is specialized for the camera hardware.
We could investigate using v4l2
instead of the MMAL API for USB webcams but it would be a major refactor. I'm not certain we would be able to provide equal coverage for all of the same controls and parameters that are exposed by MMAL, which would also be variable depending on the USB camera. So that might be kind of weird, but not impossible.
I'm not too familiar with v4l2
so my advice would be to look into using v4l2
with your webcam first on Raspian, then look for possible routes to integrate it with Elixir and Nerves, then we can go from there. There will likely be some C code involved there too. Not sure how you feel about that.
If you're looking for a quick win with just Raspian, another option to look into would be using gstreamer
.
By the way, I did come across some folks who were trying to use v4l2
with the Pi camera module here. So it's not crazy to think there might be a way to use a consolidated API for both USB and Pi camera, although I'm not sure picam
would be the right place for that. I'm open to ideas though, as long as we can retain the MMAL integration.
My 2 cents on this is that a v4l2
library should be a separate package. v4l2
will work on pretty much any Linux system which is nice. On the other hand, the Raspberry Pi Camera w/ the MMAL API has some seriously awesome features that aren't available from v4l2
. There's also a lot of variety in what's supported with v4l2
and you end up needing to understand v4l2
to figure out what you can do at the application layer. Anyway, it would be cool to have, but I don't think that I'd attempt it here.
@Qqwy Did you get a chance to check out v4l2
?
@electricshaman I did not; in the end, because of time constraints, I ended up buying a Raspberry Pi camera and just using that one instead.
I agree that using a v4l2
-based system would require probably too much changes in the current set-up of Picam, so it might be a better idea to maybe wrap it as a separate library at some point.
Thanks for your help! :heart:
I already have an USB webcam lying around, and would rather not buy an extra hardware component if not really necessary, so therefore:
Is it possible to use a USB webcam instead of the Raspberry Pi Camera module? (Or if not, how difficult would it for me to fork the project and add this, possibly creating a Pull Request if desired?)