I know there is at least one more thread for the same issue but I did not see a resolution so I decided to open a new thread for the same.
I am getting err = -1 when trying to set the format on the VGA camera using VIDIOC_S_FMT as the ioctl request code. I tried using different supported pixel formats (YUV, RGB..)
Has anyone been able to find the answer to this ?
ioctl(camera->fd, VIDIOC_S_FMT, &format)
Is there a solution to why the ioctls fail ? The command C=10 INPUT=0 MODE=PREVIEW ./capture_examples --userp -d /dev/video0 works and does the above. I am calling the same ioctls in my app. This is taking way too much of my time on something that seems to be either a hardware/kernel issue.
Glad to hear you're able to take pictures with the camera. However, we're unsure why you're still receiving those errors if you're now able to take pictures with the camera.
When we added the sample-apps layer and managed to use the camera, the error 22 would disappear. Would you please let us know, now after adding the sample-apps, what other commands of settings have you changed to receive VIDIOC_S_FMT or STREAMON errors? Could you share more information about your app?
As you see the below works. It uses MODE=PREVIEW.
root@intel-aero:~# C=10 INPUT=0 MODE=PREVIEW ./capture_examples --userp -d /dev/video0
Preview mode: 640x480, yuv420.
m_width 640, m_height 480, m_sizeimage 462848, m_padded_width:640, bytesperline 640
Saving file: Image-video2-640x480-0.yuv420
Saving file: Image-video2-640x480-1.yuv420
Saving file: Image-video2-640x480-2.yuv420
Saving file: Image-video2-640x480-3.yuv420
Saving file: Image-video2-640x480-4.yuv420
Saving file: Image-video2-640x480-5.yuv420
Saving file: Image-video2-640x480-6.yuv420
Saving file: Image-video2-640x480-7.yuv420
Saving file: Image-video2-640x480-8.yuv420
Saving file: Image-video2-640x480-9.yuv420
Preview: Time=334.389000ms FPS=29.905290
When I tried using MODE=VIDEO, I got the error 22. Can you tell me if this camera is not set up for VIDEO streaming ?
root@intel-aero:~# C=10 INPUT=0 MODE=VIDEO ./capture_examples --userp -d /dev/video0
Video mode: 640x480, yuv420.
Setting fps to 30
VIDIOC_S_FMT error 22, Invalid argument
Also, in my app, I am doing almot exactly what capturev4l2 is doing in v4l2_obj.cpp. What would you like to know ?
I can now detect the ov7251 camera in my app. I still have to try capturing images and video streaming using it from my app, but its a start. I will keep you updated via this thread.
I do not think VIDEO is working. But let me know what you find. Also, I am trying to use the frames I get with gstreamer and QGC but that seems to not be working like the way it did with realsense R200. here is my pipeline construction -
snprintf(str_pipeline, sizeof( str_pipeline ), "appsrc name=mysource ! videoconvert ! "
"video/x-raw,width=640,height=480,format=NV12 ! rtpjpegpay ! jpegenc ! videocrop top=0 left=0 right=40 bottom=10 ! " "udpsink host=%s port=5600", "192.168.8.2");
pipeline = gst_parse_launch( str_pipeline, &error );
appsrc = gst_bin_get_by_name( GST_BIN( pipeline ), "mysource" );
app_caps = gst_caps_new_simple( "video/x-raw", "format", G_TYPE_STRING, "I420",
"width", G_TYPE_INT, WIDTH, "height", G_TYPE_INT, HEIGHT, NULL );
gst_app_src_set_caps( GST_APP_SRC( appsrc ), app_caps );
gstbuffer = gst_buffer_new_wrapped_full( ( GstMemoryFlags )0, frame_ptr, gst_size, 0, gst_size, NULL, NULL ); // frame_ptr and gst_size are the buffer and sizes respectively.
g_signal_emit_by_name( appsrc, "push-buffer", gstbuffer, &ret );
192.168.8.2 is my ubuntu machine where QGC is installed.
I have talked to some Intel engineers who work on the intel aero and it seems the VIDEO mode is not tested. Only the PREVIEW mode. Can you please confirm your results with VIDEO mode ?
Also there seems to be an issue with streaming using ov7251 - I have opened a bug for it. Have you been able to stream using ov7251 using gstreamer and QGC ?