This is a quarter-continuation from this post : How To : Stream A Webcam From The Raspberry Pi
I had a look at the settings that I was using to stream from my Raspberry Pi as I had it doing other things for a while, and I was using 320×240 @ 10fps. Some people were having some issues where the streaming would either not start, or would stop very quickly.
I bumped up the resolution to 640×480 and I started having the same issue. I was getting errors like the one below –
[video4linux2,v4l2 @ 0x1d4e520] The v4l2 frame is 40588 bytes, but 614400 bytes are expected
After some looking around, I found some utilities that I could use to glean some more information about my webcam.
v4l2-ctl could show the capabilities of the webcam itself. I installed some other v4l utilities while I was at it in case I needed them later.
apt-get install v4l-utils v4l-conf
After I installed it, I could check to see whether my webcam could stream in mjpeg format directly.
root@raspbian:~# v4l2-ctl --list-formats
Index : 0
Type : Video Capture
Pixel Format: 'YUYV'
Name : YUV 4:2:2 (YUYV)
Alas, it seems like mine can’t. So I’ll have to find out why the frames are getting cut short.
Lowering the resolution to 160×120 helps but that’s not really an ideal solution.
I had a spare webcam to try out, and the spare webcam worked on 640×480 without any tweaking.
Seems that some webcams just can’t do what we want them to do !
For now, I have another webcam streaming 640×480 @ 7fps and it seems to be working. I’ll report back on results soon !