Open Arnold1 opened 1 year ago
Hi,
I have a few questions to the raspberry pi camera-module 3 and its picamera2 lib:
- can you use the raspberry pi camera-module 3 with Raspberry Pi Pico, Raspberry Pi Zero W, and Raspberry Pi Zero 2 W?
You can't use it with the Pico. The Pico has no camera support. You can use it with the Zero W and Zero 2 W (Zero 2 W will perform significantly better).
- is the picamera2 lib available for Raspberry Pi Pico, Raspberry Pi Zero W, and Raspberry Pi Zero 2 W?
- when will picamera2 be fully released?
As above, it's not available for the Pico. I'm not quite sure when we shall call it "version 1.0". libcamera is still in development but it would probably make sense to label a full release in the fairly near future once we find we're no longer changing very much.
Thanks
@davidplowman thanks for the info.
Is there a way to wakeup the raspberry pi zero 2 w and the pi camera module 3 stream the video for 1 minute and go to sleep again - so it saves energy?
Can you do create a webocket connection and stream the video to a server? and the server will provide the live video to other users...
will that be something like the following?
import asyncio
import picamera2
import time
import websockets
async def stream_video(websocket, path):
picam2 = picamera2.Picamera2()
video_config = picam2.create_video_configuration({"size": (1280, 720)})
picam2.configure(video_config)
encoder = picamera2.encoders.H264Encoder(1000000)
stream = picam2.start_recording(encoder, "h264")
try:
while True:
data = stream.read1(32768)
if not data:
break
await websocket.send(data)
finally:
picam2.stop_recording()
async def main():
async with websockets.connect("ws://REMOTEIP:10001") as websocket:
await stream_video(websocket, "/")
if __name__ == "__main__":
asyncio.run(main())
Hi, I don't specifically know anything about websockets, but I'm sure this kind of thing is possible. There are a number of examples that involve web streaming, perhaps these would be helpful?
The start_recording
method doesn't give you a stream, but if you look at some of those examples you'll see that you can write directly to a socket (here), or create your own output class to do whatever you want (here).
thank you.
Is there a way to wakeup the raspberry pi zero 2 w and the pi camera module 3 stream the video for 1 minute and go to sleep again - so it saves energy?
I guess it depends what you mean by "sleep". Do you mean just stop running the camera? Or some kind of power saving mode? I'm afraid that's not something I know about - maybe try asking on the regular forums where you might pick up a more knowledge person!
i mean to power off the camera to save energy and power on again, instead of having it run 24/7.
some other question to the picamera2 lib: i saw it uses the libcamera library which seems to be written in c/c++. what additional features does picamera2 have compared to libcamera? could i also use libcamera lib: https://github.com/kbingham/libcamera and access the raspberry pi camera-module 3 using raspberry pi zero 2?
i mean to power off the camera to save energy and power on again, instead of having it run 24/7.
Probably best to ask on one of the regular forums there, that's not something where I would necessarily know the best answers.
some other question to the picamera2 lib: i saw it uses the libcamera library which seems to be written in c/c++. what additional features does picamera2 have compared to libcamera? could i also use libcamera lib: https://github.com/kbingham/libcamera and access the raspberry pi camera-module 3 using raspberry pi zero 2?
That repo looks to be a mirror/fork of the official libcamera repo (kbingham being one of the libcamera developers, of course). Normally we would recommend Pi users to build from our own fork. We do try to keep this exactly in line with the official libcamera, but from time to time "stuff" happens (as libcamera is still in very active development and we need to stay at the bleeding edge) so you're generally safer on the Raspberry Pi version, where we have verified that things work correctly.
Picamera2 is built entirely on libcamera. Obviously it's Python and most folks would find it much easier to use, but you can program directly against the libcamera C++ API if you prefer. You can compare the experience of writing lower level C++ applications against Python ones.
Hi, is there anything else to investigate here? Thanks.
hi, i try to allocate some time this month to look at things.
Hi,
I have a few questions to the raspberry pi camera-module 3 and its picamera2 lib:
Thanks