Open enriquedelpino opened 5 years ago
Hi @enriquedelpino,
Thanks for the details. I'm currently in the middle of moving, so I can't look into this into too much depth right now, but a few things to try.
Could you try adding --userp as a command line option to see whether this works?
./cam_overlay.bin --userp
Does the device work when using v4l2-ctl directly?
v4l2-ctl --stream-mmap --stream-count=1 -d /dev/video0 --stream-to=output.dat --verbose
Thanks for the quick response @meekys,
This is the output from the commands you've suggested to run:
pi@CRANKSHAFT-NG:/opt/crankshaft/cam_overlay $ ./cam_overlay.bin --userp
Opened device '/dev/video0'
Dimensions: 640 x 480 Pixel Format: YUYV
Out of memory
pi@CRANKSHAFT-NG:/tmp $ v4l2-ctl --stream-mmap --stream-count=1 -d /dev/video0 --stream-to=output.dat --verbose
VIDIOC_QUERYCAP: ok
VIDIOC_REQBUFS: failed: Cannot allocate memory
There is something extra I did not mention earlier on. I have been able to have the camera getting a screenshot using fswebcam
and also to record a short video using ffmpeg
, so it seems the camera runs happily on the RPi
pi@CRANKSHAFT-NG:/tmp $ ffmpeg -t 120 -f v4l2 -framerate 25 -video_size 640x80 -i /dev/video0 output.mkv
@enriquedelpino Sorry I've taken a while to get back to you on this. Been caught up with life and a re-write. I have to admit, it looks like it's a memory issue. I wonder if it's related to this line Size Image : 3085365528 If so, the poor system might be trying to allocate ~2942.4MB It's interesting that the v4l2 input from ffmpeg doesn't seem to be having issues with this, I wonder what they do differently.
@enriquedelpino Too add to this, could you try the following if you're able to compile from source?
https://github.com/meekys/cam_overlay/blob/master/cam_overlay.c#L905
Change fmt.fmt.pix.sizeimage
to fmt.fmt.pix.bytesperline * fmt.fmt.pix.height
and see if this resolves the issue?
Hi @enriquedelpino, I've added this fix into a new branch (cpp) after a 'bit' of refactoring https://github.com/meekys/cam_overlay/tree/cpp Let me know how this goes.
I used the cpp branch It somehow gives this error with one of my videograbbers but doesn't give the error with the master branch. (Version used in Crankshaft NG alpha 5)
@Bishamon1987 Yeah, it's an odd error. From what I can tell the driver was reporting a stupidly big sizeimage vs what was required, resulting in an out of memory error. (If it's the same issue) That being said, I thought/hoped it might have been fixed on the cpp branch.
Could I get the output of v4l2-ctl --all
when both devices are plugged in. We might be able to figure out what they're reporting and figure out why this is occurring for one device, but not the other.
Hi there,
I'm just trying to get started using cam_overlay (through crankshaft) to fire up a rear cam in my car. I'm getting a memory issue with the webcam which I'm using to test my setup, and I am not sure whether the problem is coming from my setup, or rather if this is a problem someone has come across before:
Also I can provide the details of the camera used: