RaspberryPi_WebRTC
RaspberryPi_WebRTC copied to clipboard
Support: USB Camera
Can I use other cameras connected via USB with Raspberry PI 4, or is the raspberry pi based CSI Camera Module required?
Thank you
Yes, you can. My Pi 4B uses a USB camera.
I suggest running v4l2-ctl -d /dev/video0 --list-formats in advance to confirm the supported formats of the USB camera. My USB camera only supports specific formats, and V4L2 can't read it if my settings don't match.
Thank you!
@TzuHuanTai I am getting this error, what can I do?
Use h264 format source in v4l2
[v4l2_utils] Error: fd(16) set fps(30): Inappropriate ioctl for device
Could you please check the support format of your webcam? And what is your full command and settings right now?
Here is the way I use webcam on pi, fyi
-
Enable lagecy v4l2 driver, ref
-
Check the support format of the webcam and run it.
pi@home-pi-5:~ $ v4l2-ctl -d /dev/video0 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture
[0]: 'MJPG' (Motion-JPEG, compressed)
Size: Discrete 352x288
Interval: Discrete 0.033s (30.000 fps)
Size: Discrete 640x480
Interval: Discrete 0.033s (30.000 fps)
Size: Discrete 800x600
Interval: Discrete 0.050s (20.000 fps)
Size: Discrete 1280x720
Interval: Discrete 0.033s (30.000 fps)
...
pi@home-pi-5:~ $ ./pi_webrtc --device=/dev/video0 --v4l2_format=mjpeg --fps=30 --width=1920 --height=1080 --mqtt_host=xxxx --mqtt_port=8883 --mqtt_username=xxxx --mqtt_password=xxxx --uid=xxxx
Use mjpeg format source in v4l2
[v4l2_utils] Error: fd(26) set ctrl(9963810): Invalid argument
[v4l2_utils] Error: fd(26) set ext ctrl(10029519): Invalid argument
Sometime it might show some errors about v4l2 setting while running pi_webrtc.
Because not every webcam supplier implement all v4l2 setting support, and pi_webrtc always try to set bitrate/roration to the camera initially, but it doesn't bother the streaming.
It worked thanks
see #237