• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Raspberry Pi 3 streaming camera


New Member

Messages: 3

Hello, I'm trying to get a usb camera working on a Raspberri Pi 3 with FreeBSD 12/HEAD. Some time ago I made a PC-based C/SDL identification system that takes pictures of people. I want it to run on 4 RPI 3 boards. The conversion to aarch64 goes very well, I only have to fix some touchscreen issues, the camera and a system clock.
The camera is a problem. It works somehow with a logitech C310 with running webcamd and pwcview but I can't get anything better than 320x200. Higher resolutions result in a pink screen, or crash pwcviewer with message "libv4l2 error dequeuing buf: Device not configured" or libjpeg complaining about reading beyond end of data.
On a default Raspbian system and on 32-bit FreeBSD 10.1 PC's the camera works without big problems, however on PC's I still have bandwidth issues. The camera likes to jam signals of touchscreens, cardreaders and the printer sometimes but I can live with that.

My own uneditted C/SDL-program from the PC system shows a messed up view or crashes, but some visible cam data is coming through. It used to show a fullscreen 640x480 10fps view, cut out the face and save a jpg of it on a mouse-click.
I will add the code here if required.

Things I tried:
- Compiling webcamd with debug on: Works the same, shows nothing while starting or while running pwcview.
- Setting sysctl var hw.usb.dwg_otg.debug=1: results in strange irresponsive system state, with stdin spamming the terminal with empty lines. Reboot is required.
- Tried the same setup with a RPI 2 and FreeBSD 11.1 REL: exact same problem. So v4l1 vs. v4l2 is probably not the problem.
- Switching packages pwcview/pwcbsd, optionally loading the pwc.ko module of pwcbsd, switched between kernel modules cuse4bsd and cuse: no differences noticed.
-unplugging all other USB devices and ethernet and start pwcview after sleep command: no change.
-Downloaded the HEAD src and looked for related options but found nothing
-Connecting the cam to a external self-powered USB 2 hub: webcam fully stops working.

Where do I have to look for the cause of this?
Does it still have to do with FreeBSD not supporting 'isochronous' transfer for high speed devices, which I read on a 2014 topic?:

Is there any way to make a higher USB bandwidth possible on a RPI3?
And what other options do I have for having a 640x480 camera on a RPI3 with FreeBSD?

update: Another attempt, compiled mplayer with v4l support and try to play the /dev/video0 device:
(after starting webcamd on the cam usb device)
# mplayer -v tv:// -tv driver=v4l2:device=/dev/video0
works, in 160x120 resolution
# mplayer -v tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0
mplayer shows a pink 640x480 screen, garbled cam data is visisble sometimes, keeps running endless with 0 frame-count and "v4l2: select timeout" messages
# mplayer -v tv:// -tv driver=v4l2:width=800:height=600:device=/dev/video0
results in pink 800x600 screen and looping with errors:
libv4l2: error: got 4 consecutive frame decode errors, last error: libjpeg error: end of image
v4l2: ioctl dequeue buffer failed: input/output error, idx = 1
Any higher resolution does the same as 800x600. The C310 webcam should go to 1280x720.
Last edited:


Aspiring Daemon

Thanks: 201
Messages: 571

Welcome to the forum Manuell!

At one time I tried webcamd in that setup, and I seem to remember it doing the same thing as what you describe. Maybe it's because the software borks when the video cannot be processed quickly enough, or the video data cannot be saved quickly enough. At least that's conceivably a theory. IIRC, I got (somewhat) better results when using it in motion-only mode. I.E., the software processed slightly less data because it didn't write as much to disk. I used the syntax for "motion-only" :

pwcview -d /dev/video0 -k -f10 -u700 -r > video-motion-frames.yuv

You may ask Phishfry about this - he seems to be more knowledgeable than I about FreeBSD and video.



Thanks: 244
Messages: 1,032

I find that opencv is very useful as a library for simply capturing a buffer of footage from the webcam.

Perhaps try out / hack about with one of my prototypes: https://github.com/osen/tstream
If you look through the git history, you can see a few different techniques I have played with. Currently it looks like this:

libopencv -> stb_image (JPEG) -> mongoose (websockets) -> viewer (HTML5 / Javascript)

Another one is this:


I believe it is probably easier to try out than mine but uses crap like node.js to work.



Thanks: 604
Messages: 2,108

I do like other options like above and I want to see if the Pi's CSI camera port can be used myself.
The author of webcamd is HPS and he answers questions quite readily on the Arm mailing list.
He might be able to help.
Maybe this is a byproduct of -CURRENT? Have you compiled a NODEBUG kernel?

Have you tried multimedia/mpv instead of mplayer?