mpromonet / v4l2rtspserver

RTSP Server for V4L2 device capture supporting HEVC/H264/JPEG/VP8/VP9
The Unlicense
1.82k stars 423 forks source link

libcamera support for v4l2rtspserver #283

Open madison8935 opened 2 years ago

madison8935 commented 2 years ago

Hi there,

i'm using v4l2rtspserver for mobile video streaming from raspberrypi zero2w (Bullseye, H264) into a milestone VMS system. Low latency and reliability are the highest priorities. To my question:

I would like to use the new ArduCam Cameras (imx519), which only work with libcamera. Will v4l2rtspserver work with libcamera soon, or is there a way to pipe trough the libcamera-vid to a virtual device, which can be processed by v4l2rtspserver?

I like to apologize in advance for wierd questions, as i just started with linux and raspberrypi's. Thank you for your work and support!

mpromonet commented 2 years ago

Hi,

I never used libcamera, but it seems to have a compability layer exposing a V4L2 device. Did you try with:

  LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/v4l2-compat.so

Best Regards, Michel.

cedricve commented 2 years ago

Hey @mpromonet I did try that but didnt work out.

pi@kerberos:~ $ v4l2rtspserver -W 640 -H 480 -F 15 -P 8554 /dev/video0
log level:500

[NOTICE] /home/pi/v4l2rtspserver/main.cpp:297
  Version: 0.3.3-8-gb007df2 live555 version:2022.06.16
[NOTICE] /home/pi/v4l2rtspserver/src/V4l2RTSPServer.cpp:37
  Create V4L2 Source.../dev/video0
[NOTICE] /home/pi/v4l2rtspserver/v4l2wrapper/src/V4l2Device.cpp:133
  driver:unicam capabilities:a5a00001 mandatory:4000001
[NOTICE] /home/pi/v4l2rtspserver/v4l2wrapper/src/V4l2Device.cpp:136
  /dev/video0 support capture
[NOTICE] /home/pi/v4l2rtspserver/v4l2wrapper/src/V4l2Device.cpp:138
  /dev/video0 support read/write
[NOTICE] /home/pi/v4l2rtspserver/v4l2wrapper/src/V4l2Device.cpp:139
  /dev/video0 support streaming
[ERROR] /home/pi/v4l2rtspserver/v4l2wrapper/src/V4l2Device.cpp:212
  /dev/video0: Cannot set pixelformat to:H264 format is:YUYV
[ERROR] /home/pi/v4l2rtspserver/v4l2wrapper/src/V4l2Device.cpp:212
  /dev/video0: Cannot set pixelformat to:MJPG format is:YUYV
[ERROR] /home/pi/v4l2rtspserver/v4l2wrapper/src/V4l2Device.cpp:212
  /dev/video0: Cannot set pixelformat to:JPEG format is:YUYV
[ERROR] /home/pi/v4l2rtspserver/v4l2wrapper/src/V4l2Device.cpp:83
  Cannot init device:/dev/video0
[NOTICE] /home/pi/v4l2rtspserver/v4l2wrapper/src/V4l2MmapDevice.cpp:141
VIDIOC_STREAMOFF: Bad file descriptor
VIDIOC_REQBUFS: Bad file descriptor
  Device /dev/video
azsde commented 1 year ago

Using libcamera would be awesome, I have the exact same usecase.

Tormund1985 commented 1 year ago

Using libcamera would be awesome, I have the exact same usecase.

It would be great, because all the new cams are only supported with libcamera.

mpromonet commented 1 year ago

Hi,

You may submit pull request implementing this. This project use a standard interface V4L2, using a library is an approach, that I don't find interesting. It may be better to use a V4L2 device feed with libcamera.

Best Regards, Michel.

azsde commented 1 year ago

Hello @mpromonet, as of today, the new official raspberry camera V3 has been released, they are not compatible with the old camera stack and only are compatible with libcamera.

I assume the old V2 camera are going to be discontinued, do you plan to add support for the newer cameras (and thus libcamera support) ?

krytie75 commented 1 year ago

Also would very much like to see libcamera support for the new camera V3. A very nice upgrade from the V2 and I would like to switch several of my cameras out to this version.

I'll take the opportunity to thank @mpromonet for this wonderful tool which I have only recently started using, I have high hopes to be able to keep using it with the new camera module!

carljokl commented 1 year ago

I am curious as to how difficult the change would be to implement. If someone knows C/C++. Would it require very deep knowledge of video and Linux technology or can a mere mortal attempt the change?

azsde commented 1 year ago

It seems there a wrapper called libcamerify available in libcamera-tools (sudo apt install libcamera-tools) that allows v4l2rtspserver to work with the new cameras supported by libcamera, however i can't get the stream to play with VLC nor ffplay :(

See issue: https://github.com/mpromonet/v4l2rtspserver/issues/297

Tormund1985 commented 1 year ago

I have exactly the same problem, apparently is working fine but I can't open it with VLC nor ffplay...

Tormund1985 commented 1 year ago

Hi again, there are any new about how to use the wrapper libcamerify to get it work with bullseye? many thanks.