jamestk
Posts: 29
Joined: Wed Aug 08, 2012 9:48 pm

Streamer

Wed Sep 19, 2012 9:13 am

Hello Everyone

until yesterday I was using the 2012-07-15-wheezy-raspbian.img for my PI and had installed "streamer" which allows you to snap images from your webcam using the following command:

streamer -c /dev/video0 -b 16 -o /var/www/outfile.jpeg
Referenced from http://tldp.org/HOWTO/html_single/Webcam-HOWTO/#COMMAND

This morning I imaged my SD card with the 2012-08-16-wheezy-raspbian.img and installed "streamer" as before but this time the command "streamer -c /dev/video0 -b 16 -o /var/www/outfile.jpeg" fails complaining about the -b value so if I lower it to 8 ( number of colors in bpp, whether 15, 16, 24 or 32) it works okay, does anyone else use streamer on the "2012-08-16-wheezy-raspbian.img" image ?

Here is the error that I get when trying to use -b 16 but if i lower it to -b 15 it works, i've highlighted what i think is an issue but not being a linux person usually am kinda guessing:

streamer -c /dev/video0 -b 16 -o /var/www/outfile.jpeg
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

Regards

James

jamestk
Posts: 29
Joined: Wed Aug 08, 2012 9:48 pm

Re: Streamer

Wed Sep 19, 2012 10:15 am

Fixed it :D
Ran raspi-config
went into "memory_split Change memory split" and changed the memory split to 240MiB for ARM, 16MiB for VideoCore .

richardjohn
Posts: 1
Joined: Tue Nov 13, 2012 12:50 am

Re: Streamer

Tue Nov 13, 2012 1:04 am

cheers ;)

josn
Posts: 4
Joined: Wed Jul 04, 2012 1:56 pm

Re: Streamer

Sun Nov 25, 2012 7:36 pm

Changing the memory split will not always work. The problem is that libv4l2 claims 256MiB for the conversion buffer. That is probably way too large. At least that is more than is available on a rev1 RaspBerry Pi. You can probably solve the problem by allocating more swap space, thereby creating more virtual memory. But an easier way to do it is by giving this command before starting streamer:

Code: Select all

sysctl vm.overcommit_memory=1
This will have all memory claims succeed without any checks. The problems are postponed until the claimed memory will be really used. But most of the claimed memory will never be used, so this will work. Your best bet is to switch back to the default after using the webcam, by:

Code: Select all

sysctl vm.overcommit_memory=0
to avoid strange errors when memory really gets scarse. So it is also not a good idea to change this setting in /etc/sysctl.conf. Maybe use a script for starting streamer, and solve it there.

keble
Posts: 36
Joined: Tue Apr 03, 2012 4:46 pm

Re: Streamer

Thu Dec 13, 2012 9:57 pm

jamestk, thanks for that.
I just had the same problem with 2012-10-28 wheezy raspbian.
Reducing streamer's buffer worked!

Return to “General programming discussion”