Closed chrisgilliam72 closed 2 months ago
Hi @chrisgilliam72, could you please try the Camera
binding instead?
The most probable reason for the VideoDevice
not working anymore is because the Rasberry foundation deprecated the "legacy stack" for the newer "libcamera".
You can still revert to the first one in the raspi-config, but since I created the Camera
, you can work with both stacks.
Thanks for the response . Does the Camera device have something like the NewImageBufferReadyEvent I can hook onto ? I am wanting to stream the images to web page as per the code sample.
@chrisgilliam72 The Camera binding runs the official Raspberry PI libcamera-vid
utility and takes the video stream back.
This means that you get a continuous Stream
flow that you can send to a web page. On the binding side, I could not expose that event because the stream content depends on the options you pass to the tool.
The code samples just show how to acquire the stream, but I successfully streamed the byte[]
flow to the browser (which needs a video player javascript library).
I did this in the past with the H264 stream because it is low-bandwidth, but I had to manually separate the individual frames because the javascript library required the video frame separation.
If you don't want to mess with H264, you can change the codec to MJPEG (I believe this was the VideoDevice
default codec) but I don't know if the frame separation is still needed (it should be easier to implement.
I planned to post the video frame splitting code, but it will take some time.
Oh I see . Thanks. Do you have any sample code I can work from ? Code that streams using libcamera-vid to a web page ?
Unfortunately, the code I use is far more complex and I cannot share it as-is.
In the binding sample, you can see how to obtain a Stream
. You can use it to feed the communication channel, typically WebSockets or SignalR (which is a .NET library wrapping either Websocket or long polling). This let you send the stream from the server to the client.
In terms of coding, you have to set up a small ASP.NET Core web application that uses straight websockets or the SignalR library. The official documentation walks through a sample sending messages from the server to the browser. This other page shows how to use streaming using SignalR.
HTH
Is there anyway to turn the preview window off ?
@chrisgilliam72 sure, you just have to specify the option matching the command line for the libcamera-vid
tool which is documented on the Raspberry pi website.
HTH
Hi @chrisgilliam72, could you please try the
Camera
binding instead?The most probable reason for the
VideoDevice
not working anymore is because the Rasberry foundation deprecated the "legacy stack" for the newer "libcamera". You can still revert to the first one in the raspi-config, but since I created theCamera
, you can work with both stacks.
I have checked those camera binding and it looks like it does not work also on RaspBerry Pi 5. Even listing cameras. I have couple of them it is working on RaspBerry Pi 4 but not on 5th.
I have checked those camera binding and it looks like it does not work also on RaspBerry Pi 5. Even listing cameras. I have couple of them it is working on RaspBerry Pi 4 but not on 5th.
@Woselko May I ask you to open a separate issue with detailed information?
The camera
binding runs a separate process with the official tool called libcamera-vid
. If the libcamera-vid
works from the terminal and does not work from the binding, there is either a misconfiguration or a bug.
But if it does not work from the terminal, there is something wrong that has nothing to do with this repo.
Thank you
@chrisgilliam72 You should be able to do this adding this line:
var builder = new CommandOptionsBuilder()
// ...
.With(CommandOptionAndValue.Create(Command.Nopreview));
I have checked those camera binding and it looks like it does not work also on RaspBerry Pi 5. Even listing cameras. I have couple of them it is working on RaspBerry Pi 4 but not on 5th.
@Woselko May I ask you to open a separate issue with detailed information? The
camera
binding runs a separate process with the official tool calledlibcamera-vid
. If thelibcamera-vid
works from the terminal and does not work from the binding, there is either a misconfiguration or a bug. But if it does not work from the terminal, there is something wrong that has nothing to do with this repo.Thank you
Exactly, it works from terminal but now from the binding. I will open a separate bug.
Can someone explain me why there is so much differences between raspberry pi 4 and raspberry pi 5? Only few devices from this package works from me.
Exactly, it works from terminal but now from the binding. I will open a separate bug.
Thank you, please detail the specific error.
Can someone explain me why there is so much differences between raspberry pi 4 and raspberry pi 5? Only few devices from this package works from me.
The Broadcom chipset is different. Did you find a commn root for these issues?
It may depend on the libgpiod
vs sysfs
driver usage (there are relevant issues on the Pi5 and libgpiod
).
In any case, please open one or more issues on this.
@Woselko can you clarify which devices stopped working for you in the Pi5? Essentially we are trying to understand if these are devices using I2c communication or GPIO, in order to try to narrow down the issue.
@joperezr here I made an issue: https://github.com/dotnet/iot/issues/2266 @raffaeler I did not find common root for this issue. Im implementing all of the devices on my own under this repo: https://github.com/Woselko/DotnetRaspBerryPi5Patterns
@Woselko
with regards to the request #2266 I commented there.
You are doing a great work on your repo. Should you want to contribute in this repo as well, you are more than welcome :-)
Camera binding (this issue). Please provide more detailed info about the problems if you still can't make it work the Camera binding on the RPi5. As I wrote in previous comments, the video stream is acquired by the native utilities, therefore I do not expect the RPi5 to be the culprit here. The binding just wraps the utilities in order to obtain the stream from the Camera. If instead you could make it work, please close this issue.
Thank you!
@raffaeler thanks :), maybe I'll try to contribute some devices that I have that I could not find in repository.
@chrisgilliam72 check my LibCamera C# wrapper in my RaspberryPi 5 repo: https://github.com/Woselko/DotnetRaspBerryPi5Patterns
there is project called RaspCameraLibrary which is libcamera wrapper and I was able to stream some video locally on raspberry pi 5 server with CameraStreamServer project.
im still new to raspberry platform so it can be some mistakes :)
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.
I have been successfully using the code sample I found here: https://neilsnotes.net/Software/Coding/dotnetPiCam.html To capture images from my Raspberry PI with camera module v2.1
I recently bought a new camera module v3. The same code runs but when I try to view the captured image it , the image appears to be corrupt : Error interpreting jpeg image file (not a jpeg file starts with 0x00 0x00)