We use Raspberry pi for computer vision / machine vision solutions. We developed our stuff offline using videos recorded using raspivid, but for real-time processing we are using video4linux 2 and gstreamer-1.0 with v4l2 input module.
Now I have discovered that the raw video using v4l2 markedly differs from the video recorded using raspivid, especially gain control is totally off, so it messes up our application, we would need to re-tune the parameters, which is something we really don't want to do. (I checked the video by using v4l2 to capture video and then encoded into .h264 using omxh264 gstreamer module).
The best way of fixing this would be forcing raspivid to provide raw RGB output, which we will pipe into our app (we used FIFOs before to get raw video from gstreamer to our app, so no, this is not an issue). So, hopefully all other nice settings that raspivid sends to the camera will remain exactly the same.
I identified the relevant portion of the code at https://github.com/raspberrypi/userland ... RaspiVid.c, starting at line 836:
Code: Select all
if (len==4 && !strncmp("H264", argv[i+1], 4))
state->encoding = MMAL_ENCODING_H264;
else if (len==5 && !strncmp("MJPEG", argv[i+1], 5))
state->encoding = MMAL_ENCODING_MJPEG;
else
valid = 0;
So I thought of patching the code as follows (see additional two lines!)
Code: Select all
if (len==4 && !strncmp("H264", argv[i+1], 4))
state->encoding = MMAL_ENCODING_H264;
else if (len==5 && !strncmp("MJPEG", argv[i+1], 5))
state->encoding = MMAL_ENCODING_MJPEG;
else if (len==4 && !strncmp("RGB3", argv[i+1], 4))
state->encoding = MMAL_ENCODING_RGB24;
else
valid = 0;
