I've connected a Logitech c170 webcam to a Raspberry Pi via an externally powered USB hub. It's running Raspbian Wheezy.

The camera is detected by the Pi when plugged in, and running VLC even causes the light on the camera to turn on. However, no image is displayed. I tried to grab an image using streamer and got the following output

files / video: JPEG (JFIF) / audio: none
libv4l2: error allocating conversion buffer
mmap: Cannot allocate memory
v4l2: ioctl(fildes = 3 "/dev/video0", request = VIDIOC_QBUF, struct v4l2_buffer *data = { index = 0, type = 0, bytesused = 0, flags = 0, field = V4L2_FIELD_ANY, timestamp = { 0 seconds }, timecode = { type = 0, flags = 0, frames = 0, seconds = 0, minutes = 0, hours = 0 }, sequence = 0, memory = 0, length = 0, input = 0 }) failed, Invalid argument (22, EINVAL) because the data->type argument was incorrectly specified
v4l2: oops: select timeout

And when I killed the program this error was printed many times

munmap: Invalid argument

Is there a driver missing?

  • Results with webcams (and USB devices in general) vary widely from one firmware rev to the next. Can you give us a "uname -a" ? Commented May 11, 2013 at 1:23

2 Answers 2


This is a known problem with libv4l2 and the Raspberry Pi.

The thing is it tries to allocate 256MB os RAM to make that conversion, which is all the memory of Model A and half of Model B.

If you are using model A your only hope is to create a Swap file/drive big enough for accomodating that conversion. 256MB should be the minimum.

If you are using model B, free up some memory closing programs or just do like model A and create some swap space.


Not much of an answer but it may help and is too long for a comment.

I use this one and it works fine using Runtime.getRuntime().exec("fswebcam -p YUYV -d /dev/video0 -i 0 -r 640x480 -S 40 --jpeg 75 --top-banner bottompic.jpg"); That's in java just run the part in quotes from the command line.

I need to use -p YUYV and max I can get to work is 640x480.

If I don't skip around 40 frames the image isn't adjusted for lighting.

I'm not taking pics of people's bottoms, despite the name ;).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.