Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support: USB Camera #185

Open
rkenzhebekov opened this issue Sep 22, 2024 · 5 comments
Open

Support: USB Camera #185

rkenzhebekov opened this issue Sep 22, 2024 · 5 comments

Comments

@rkenzhebekov
Copy link

rkenzhebekov commented Sep 22, 2024

Can I use other cameras connected via USB with Raspberry PI 4, or is the raspberry pi based CSI Camera Module required?

Thank you

@TzuHuanTai
Copy link
Owner

TzuHuanTai commented Sep 22, 2024

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.

@rkenzhebekov
Copy link
Author

Thank you!

@boredom1234
Copy link

boredom1234 commented Oct 30, 2024

@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

@TzuHuanTai
Copy link
Owner

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

  1. Enable lagecy v4l2 driver, ref

  2. 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.

@boredom1234
Copy link

boredom1234 commented Nov 2, 2024

It worked thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants