edrosten / libcvd

libcvd - efficient and easy to use C++ computer vision library.
Other
238 stars 103 forks source link

ioctl calls never returning 0 #19

Closed HDaoud closed 8 years ago

HDaoud commented 8 years ago

Hello Dear Edward,

in the v4lbuffer.cc there is a loop for(f.index=0; ioctl(fd, VIDIOC_ENUM_FMT, &f) == 0; f.index++)

when I'm trying to run CameraCalibrator of PTAMM which reads virtual device /dev/video2 created using v4l2 loopback, I noticed that the ioctl(fd, VIDIOC_ENUM_FMT, &f) and ioctl(fd, VIDIOC_G_FMT, &format) never 0, thus exception is thrown.

Below is log output:

RawV4LBuffer: verbose operation. Initializing RawV4LBuffer: Querying capabilities. RawV4LBuffer: driver: v4l2 loopback RawV4LBuffer: card: Dummy video device (0x0000) RawV4LBuffer: bus_info: platform:v4l2loopback-000 RawV4LBuffer: version: 200711 RawV4LBuffer: capabilities: 0x85008003 RawV4LBuffer: V 4 L 2_CAP_VIDEO_CAPT URE = 1 RawV4LBuffer: V 4 L 2_CAP_VIDEO_OUTP UT = 1 RawV4LBuffer: V 4 L 2_CAP_VIDEO_OVER LAY = 0 RawV4LBuffer: V 4 L 2_CAP_VBI_CAPTUR E = 0 RawV4LBuffer: V 4 L 2_CAP_VBI_OUTPUT = 0 RawV4LBuffer: V 4 L 2_CAP_SLICED_VBI _CAPTURE = 0 RawV4LBuffer: V 4 L 2_CAP_SLICED_VBI _OUTPUT = 1 RawV4LBuffer: V 4 L 2_CAP_RDS_CAPTUR E = 0 RawV4LBuffer: V 4 L 2_CAP_VIDEO_OUTP UT_OVERLAY = 0 RawV4LBuffer: V 4 L 2_CAP_TUNER = 1 RawV4LBuffer: V 4 L 2_CAP_AUDIO = 0 RawV4LBuffer: V 4 L 2_CAP_RADIO = 0 RawV4LBuffer: V 4L2_CAP_READWRITE = 1 RawV4LBuffer: V 4 L 2_CAP_ASYNCIO = 0 RawV4LBuffer: V 4 L 2_CAP_STREAMING = 1 RawV4LBuffer: Requested format: YU12 RawV4LBuffer: Enumerating formats. RawV4LBuffer: Index F ourCC Fl ag Description RawV4LBuffer: struct: 48`

I added the following before the loop: log << "struct: " << f.index << "\n" << f.description << "\nformat: " << fmt << "\npixelformat: "<< f.pixelformat << " -> "<<unfourcc(f.pixelformat)<< "\nV4L2GREY: "<<V4L2_PIX_FMT_GREY<<"\n";

and the result: struct: 48 format: 842093913 pixelformat: 32674 -> � V4L2GREY: 1497715271

I'm trying to read the yuv420 video (640x368 30hz) from the virtual device.

Thanks.

edrosten commented 8 years ago

On 26 May 2016 at 10:33, HDaoud notifications@github.com wrote:

Hello Dear Edward,

in the v4lbuffer.cc there is a loop for(f.index=0; ioctl(fd, VIDIOC_ENUM_FMT, &f) == 0; f.index++)

when I'm trying to run CameraCalibrator of PTAMM which reads virtual device /dev/video2 created using v4l2 loopback, I noticed that the ioctl(fd, VIDIOC_ENUM_FMT, &f) and ioctl(fd, VIDIOC_G_FMT, &format) never 0, thus exception is thrown.

Hi,

This sounds like a bug. How are you setting up the loopback? I'd like to test this on my machine.

Also, I don't have PTAMM at the moment. Can you test it using libCVD's video player, to see if it gives the same result?

Also, is that the complete log from V4L buffer? I'd normally expect it to enumerate the framerates and sizes and so on.

Thanks for the bug reports!

-Ed

Below is log output:

` RawV4LBuffer: verbose operation. Initializing RawV4LBuffer: Querying capabilities. RawV4LBuffer: driver: v4l2 loopback RawV4LBuffer: card: Dummy video device (0x0000) RawV4LBuffer: bus_info: platform:v4l2loopback-000 RawV4LBuffer: version: 200711 RawV4LBuffer: capabilities: 0x85008003 RawV4LBuffer: V 4 L 2_CAP_VIDEO_CAPT URE = 1 RawV4LBuffer: V 4 L 2_CAP_VIDEO_OUTP UT = 1 RawV4LBuffer: V 4 L 2_CAP_VIDEO_OVER LAY = 0 RawV4LBuffer: V 4 L 2_CAP_VBI_CAPTUR E = 0 RawV4LBuffer: V 4 L 2_CAP_VBI_OUTPUT = 0 RawV4LBuffer: V 4 L 2_CAP_SLICED_VBI _CAPTURE = 0 RawV4LBuffer: V 4 L 2_CAP_SLICED_VBI _OUTPUT = 1 RawV4LBuffer: V 4 L 2_CAP_RDS_CAPTUR E = 0 RawV4LBuffer: V 4 L 2_CAP_VIDEO_OUTP UT_OVERLAY = 0 RawV4LBuffer: V 4 L 2_CAP_TUNER = 1 RawV4LBuffer: V 4 L 2_CAP_AUDIO = 0 RawV4LBuffer: V 4 L 2_CAP_RADIO = 0

RawV4LBuffer: V 4L2_CAP_READWRITE = 1 RawV4LBuffer: V 4 L 2_CAP_ASYNCIO = 0 RawV4LBuffer: V 4 L 2_CAP_STREAMING = 1 RawV4LBuffer: Requested format: YU12 RawV4LBuffer: Enumerating formats. RawV4LBuffer: Index F ourCC Fl ag Description RawV4LBuffer: struct: 48

I added the following before the loop:

log << "struct: " << f.index << "\n" << f.description << "\nformat: " << fmt << "\npixelformat: "<< f.pixelformat << " -> "<<unfourcc(f.pixelformat)<< "\nV4L2GREY: "<<V4L2_PIX_FMT_GREY<<"\n"; `

and the result:

format: 842093913 pixelformat: 32674 -> �� V4L2GREY: 1497715271

I'm trying to read the yuv420 video (640x368 30hz) from the virtual device.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/edrosten/libcvd/issues/19

HDaoud commented 8 years ago

Hi,

Yes I'm setting the loopback and gstreamer using the following command: gst-launch -v multifilesrc location=[video location] loop=1 caps="video/x-raw-yuv,width=640,height=368,framerate=30/1,format=(fourcc)I420" ! ffmpegcolorspace ! videorate ! v4l2sink device=/dev/video2 and when query v4l2-ctl --all -d /dev/video2 the results: '

Driver Info (not using libv4l2): Driver name : v4l2 loopback Card type : Dummy video device (0x0000) Bus info : platform:v4l2loopback-000 Driver version: 3.16.7 Capabilities : 0x85008003 Video Capture Video Output Video Memory-to-Memory Read/Write Streaming Device Capabilities Device Caps : 0x05008003 Video Capture Video Output Video Memory-to-Memory Read/Write Streaming Video input : 0 (loopback: ok) Video output: 0 (loopback in) Format Video Capture: Width/Height : 640/368 Pixel Format : 'YU12' Field : None Bytes per Line: 640 Size Image : 353280 Colorspace : SRGB Format Video Output: Width/Height : 640/368 Pixel Format : 'YU12' Field : None Bytes per Line: 640 Size Image : 353280 Colorspace : SRGB Streaming Parameters Video Capture: Frames per second: 30.000 (30/1) Read buffers : 8 Streaming Parameters Video Output: Frames per second: 30.000 (30/1) Write buffers : 8 User Controls keep_format (bool) : default=0 value=0 sustain_framerate (bool) : default=0 value=0 timeout (int) : min=0 max=100000 step=1 default=0 value=0 timeout_image_io (bool) : default=0 value=0 '

I downloaded PTAMM from here

That's all what I got and after that the exception error: !! Failed to run CameraCalibrator; got exception. Exception was: V4LBuffer: No colourspace on /dev/video2 matching None

How can I test it using libCVD's video player?

Thank you!

edrosten commented 8 years ago

video_play_source v4l2:[verbose]///dev/video2

video_play_source expects RGB video, so if video2 does not offer it, you'll need to add in a colourspace transform. My webcam only offers YUV422, for example, so my URL string is:

video_play_source colourspace:[from=yuv422]//v4l2:[verbose]///dev/video0

It might be easier to replace the v4lbuffer in PTAMM with a VideoBuffer, and then use open_video_source. That accepts URL-like strings and can open videos from a wide variety of sources (v4l2 devices, firewire devices, JPEG streaming security cameras, lists of images, video files).

-Ed

On 26 May 2016 at 17:22, HDaoud notifications@github.com wrote:

Hi,

Yes I'm setting the loopback and gstreamer using the following command: gst-launch -v multifilesrc location=[video location] loop=1 caps="video/x-raw-yuv,width=640,height=368,framerate=30/1,format=(fourcc)I420" ! ffmpegcolorspace ! videorate ! v4l2sink device=/dev/video2 and when query v4l2-ctl --all -d /dev/video2 the results: '

Driver Info (not using libv4l2): Driver name : v4l2 loopback Card type : Dummy video device (0x0000) Bus info : platform:v4l2loopback-000 Driver version: 3.16.7 Capabilities : 0x85008003 Video Capture Video Output Video Memory-to-Memory Read/Write Streaming Device Capabilities Device Caps : 0x05008003 Video Capture Video Output Video Memory-to-Memory Read/Write Streaming Video input : 0 (loopback: ok) Video output: 0 (loopback in) Format Video Capture: Width/Height : 640/368 Pixel Format : 'YU12' Field : None Bytes per Line: 640 Size Image : 353280 Colorspace : SRGB Format Video Output: Width/Height : 640/368 Pixel Format : 'YU12' Field : None Bytes per Line: 640 Size Image : 353280 Colorspace : SRGB Streaming Parameters Video Capture: Frames per second: 30.000 (30/1) Read buffers : 8 Streaming Parameters Video Output: Frames per second: 30.000 (30/1) Write buffers : 8

User Controls

            keep_format (bool)   : default=0 value=0
      sustain_framerate (bool)   : default=0 value=0
                timeout (int)    : min=0 max=100000 step=1 default=0 value=0
       timeout_image_io (bool)   : default=0 value=0

'

I downloaded PTAMM from http://www.robots.ox.ac.uk/~bob/software/index.html http://url

That's all what I got and after that the exception error: !! Failed to run CameraCalibrator; got exception. Exception was: V4LBuffer: No colourspace on /dev/video2 matching None

How can I test it using libCVD's video player?

Thank you!

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/edrosten/libcvd/issues/19#issuecomment-221921637

HDaoud commented 8 years ago

The usage of v4lbuffer is in the settingup for the camera, so I think changing it should be easy

VideoSource::VideoSource()
{
  cout << "  VideoSource_Linux: Opening video source..." << endl;
  string QuickCamFile = GV3::get<string>("VideoSource.V4LDevice", "/dev/video2");
  ImageRef irSize = GV3::get<ImageRef>("VideoSource.Resolution", ImageRef(640,368));
  int nFrameRate = GV3::get<int>("VideoSource.Framerate", 30);
  V4LBuffer<yuv420p>* pvb = new V4LBuffer<yuv420p>(QuickCamFile,irSize, -1, false, nFrameRate, true);

  mirSize = pvb->size();
  mptr = pvb;
  cout << "  ... got video source." << endl;
};

ImageRef VideoSource::Size()
{ 
  return mirSize;
};

void VideoSource::GetAndFillFrameBWandRGB(Image<byte> &imBW, Image<Rgb<byte> > &imRGB)
{
  V4LBuffer<yuv420p>* pvb = (V4LBuffer<yuv420p>*) mptr;
  VideoFrame<yuv420p> *pVidFrame = pvb->get_frame();
  convert_image(*pVidFrame, imBW);
  convert_image(*pVidFrame, imRGB);
  pvb->put_frame(pVidFrame);
}

could you please explain more of direct me to a guide to do what you've suggested, it seems using the VideoBuffer is more suitable.

Thanks

HDaoud commented 8 years ago

I'm trying to understand the video_play_source.cc to have an idea of what to do, but I appreciate any tips or information

edrosten commented 8 years ago

Can you try running the video_play_source program to see if you get video OK.

-Ed

On 26 May 2016 at 17:58, HDaoud notifications@github.com wrote:

I'm trying to read the video_play_source.cc to have an idea of what to do, but I appreciate any tips or information

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/edrosten/libcvd/issues/19#issuecomment-221930983

HDaoud commented 8 years ago

I run video_play_source and it works with yuv422 but not with yuv420:

'# progs/video_play_source colourspace:[from=yuv420]//v4l2:[verbose]///dev/video2 Error: ColorspaceBuffer cannot handle type yuv420'

and when changing to webcam on video0

'# progs/video_play_source colourspace:[from=yuv422]//v4l2:[verbose]///dev/video0 RawV4LBuffer: verbose operation. Initializing RawV4LBuffer: Querying capabilities. RawV4LBuffer: driver: uvcvideo RawV4LBuffer: card: Integrated_Webcam_HD RawV4LBuffer: bus_info: usb-0000:00:14.0-11 RawV4LBuffer: version: 200711 RawV4LBuffer: capabilities: 0x84000001 RawV4LBuffer: V4L2_CAP_VIDEO_CAPTURE = 1 RawV4LBuffer: V4L2_CAP_VIDEO_OUTPUT = 0 RawV4LBuffer: V4L2_CAP_VIDEO_OVERLAY = 0 RawV4LBuffer: V4L2_CAP_VBI_CAPTURE = 0 RawV4LBuffer: V4L2_CAP_VBI_OUTPUT = 0 RawV4LBuffer: V4L2_CAP_SLICED_VBI_CAPTURE = 0 RawV4LBuffer: V4L2_CAP_SLICED_VBI_OUTPUT = 1 RawV4LBuffer: V4L2_CAP_RDS_CAPTURE = 0 RawV4LBuffer: V4L2_CAP_VIDEO_OUTPUT_OVERLAY = 0 RawV4LBuffer: V4L2_CAP_TUNER = 1 RawV4LBuffer: V4L2_CAP_AUDIO = 0 RawV4LBuffer: V4L2_CAP_RADIO = 0 RawV4LBuffer: V4L2_CAP_READWRITE = 0 RawV4LBuffer: V4L2_CAP_ASYNCIO = 0 RawV4LBuffer: V4L2_CAP_STREAMING = 1 RawV4LBuffer: Requested format: YUYV RawV4LBuffer: Enumerating formats. RawV4LBuffer: Index FourCC Flag Description RawV4LBuffer: struct: 0 ! format: 1448695129 pixelformat: 0 ->
V4L2GREY: 1497715271 RawV4LBuffer: 422P: 1345466932 I420: 808596553 YU12: 842093913 YV12: 842094169 411P: 1345401140 YUV9: 961959257 YVU9: 961893977 RawV4LBuffer: 0 YUYV 0x00000000 YUV 4:2:2 (YUYV) RawV4LBuffer: frame size discrete 640x480 RawV4LBuffer: rate discrete 1/30 RawV4LBuffer: frame size discrete 160x120 RawV4LBuffer: rate discrete 1/30 RawV4LBuffer: frame size discrete 176x144 RawV4LBuffer: rate discrete 1/30 RawV4LBuffer: frame size discrete 320x180 RawV4LBuffer: rate discrete 1/30 RawV4LBuffer: frame size discrete 320x240 RawV4LBuffer: rate discrete 1/30 RawV4LBuffer: frame size discrete 352x288 RawV4LBuffer: rate discrete 1/30 RawV4LBuffer: frame size discrete 424x240 RawV4LBuffer: rate discrete 1/30 RawV4LBuffer: frame size discrete 640x360 RawV4LBuffer: rate discrete 1/30 RawV4LBuffer: frame size discrete 848x480 RawV4LBuffer: rate discrete 1/30 RawV4LBuffer: frame size discrete 1280x720 RawV4LBuffer: rate discrete 1/10 RawV4LBuffer: frame size discrete 640x480 RawV4LBuffer: rate discrete 1/30 RawV4LBuffer: 1 MJPG 0x00000001 MJPEG RawV4LBuffer: frame size discrete 1280x720 RawV4LBuffer: rate discrete 1/30 RawV4LBuffer: frame size discrete 960x540 RawV4LBuffer: rate discrete 1/30 RawV4LBuffer: frame size discrete 1280x720 RawV4LBuffer: rate discrete 1/30 RawV4LBuffer: Selected format: YUYV RawV4LBuffer: Getting format (VIDIOC_G_FMT) RawV4LBuffer: size: 640x480 RawV4LBuffer: format: YUYV RawV4LBuffer: field flag: 1 RawV4LBuffer: bytes per line: 1280 RawV4LBuffer: image size: 614400 RawV4LBuffer: colourspace: 8 RawV4LBuffer: Setting format (VIDIOC_S_FMT) RawV4LBuffer: size: 640x480 RawV4LBuffer: format: YUYV RawV4LBuffer: field flag: 0 RawV4LBuffer: bytes per line: 1280 RawV4LBuffer: image size: 614400 RawV4LBuffer: colourspace: 8 RawV4LBuffer: Getting format (VIDIOC_G_FMT) RawV4LBuffer: size: 640x480 RawV4LBuffer: format: YUYV RawV4LBuffer: field flag: 1 RawV4LBuffer: bytes per line: 1280 RawV4LBuffer: image size: 614400 RawV4LBuffer: colourspace: 8 RawV4LBuffer: Issuing VIDIOC_REQBUFS ioctl. RawV4LBuffer: Return code: 0 RawV4LBuffer: Number of buffers: 10 FPS: 0 inf Size: [640 480] N3CVD9V4LBufferINS_6yuv422EEE Using V4LBuffer. frame size: [640 480]

edrosten commented 8 years ago

On 26 May 2016 at 18:06, HDaoud notifications@github.com wrote:

I run video_play_source and it works with yuv422 but not with yuv420:

You need "yuv420p", not "yuv420". You don't necessarily need the colourspace conversion code in there. It depends on what /dev/video0 offers.

-Ed

progs/video_play_source colourspace:[from=yuv420]//v4l2:[verbose]///dev/video2

Error: ColorspaceBuffer cannot handle type yuv420

and when changing to webcam on video0

progs/video_play_source colourspace:[from=yuv422]//v4l2:[verbose]///dev/video0

RawV4LBuffer: verbose operation. Initializing RawV4LBuffer: Querying capabilities. RawV4LBuffer: driver: uvcvideo RawV4LBuffer: card: Integrated_Webcam_HD RawV4LBuffer: bus_info: usb-0000:00:14.0-11 RawV4LBuffer: version: 200711 RawV4LBuffer: capabilities: 0x84000001 RawV4LBuffer: V4L2_CAP_VIDEO_CAPTURE = 1 RawV4LBuffer: V4L2_CAP_VIDEO_OUTPUT = 0 RawV4LBuffer: V4L2_CAP_VIDEO_OVERLAY = 0 RawV4LBuffer: V4L2_CAP_VBI_CAPTURE = 0 RawV4LBuffer: V4L2_CAP_VBI_OUTPUT = 0 RawV4LBuffer: V4L2_CAP_SLICED_VBI_CAPTURE = 0 RawV4LBuffer: V4L2_CAP_SLICED_VBI_OUTPUT = 1 RawV4LBuffer: V4L2_CAP_RDS_CAPTURE = 0 RawV4LBuffer: V4L2_CAP_VIDEO_OUTPUT_OVERLAY = 0 RawV4LBuffer: V4L2_CAP_TUNER = 1 RawV4LBuffer: V4L2_CAP_AUDIO = 0 RawV4LBuffer: V4L2_CAP_RADIO = 0 RawV4LBuffer: V4L2_CAP_READWRITE = 0 RawV4LBuffer: V4L2_CAP_ASYNCIO = 0 RawV4LBuffer: V4L2_CAP_STREAMING = 1 RawV4LBuffer: Requested format: YUYV RawV4LBuffer: Enumerating formats. RawV4LBuffer: Index FourCC Flag Description RawV4LBuffer: struct: 0 ! format: 1448695129 pixelformat: 0 ->

V4L2GREY: 1497715271 RawV4LBuffer: 422P: 1345466932 I420: 808596553 YU12: 842093913 YV12: 842094169 411P: 1345401140 YUV9: 961959257 YVU9: 961893977 RawV4LBuffer: 0 YUYV 0x00000000 YUV 4:2:2 (YUYV) RawV4LBuffer: frame size discrete 640x480 RawV4LBuffer: rate discrete 1/30 RawV4LBuffer: frame size discrete 160x120 RawV4LBuffer: rate discrete 1/30 RawV4LBuffer: frame size discrete 176x144 RawV4LBuffer: rate discrete 1/30 RawV4LBuffer: frame size discrete 320x180 RawV4LBuffer: rate discrete 1/30 RawV4LBuffer: frame size discrete 320x240 RawV4LBuffer: rate discrete 1/30 RawV4LBuffer: frame size discrete 352x288 RawV4LBuffer: rate discrete 1/30 RawV4LBuffer: frame size discrete 424x240 RawV4LBuffer: rate discrete 1/30 RawV4LBuffer: frame size discrete 640x360 RawV4LBuffer: rate discrete 1/30 RawV4LBuffer: frame size discrete 848x480 RawV4LBuffer: rate discrete 1/30 RawV4LBuffer: frame size discrete 1280x720 RawV4LBuffer: rate discrete 1/10 RawV4LBuffer: frame size discrete 640x480 RawV4LBuffer: rate discrete 1/30 RawV4LBuffer: 1 MJPG 0x00000001 MJPEG RawV4LBuffer: frame size discrete 1280x720 RawV4LBuffer: rate discrete 1/30 RawV4LBuffer: frame size discrete 960x540 RawV4LBuffer: rate discrete 1/30 RawV4LBuffer: frame size discrete 1280x720 RawV4LBuffer: rate discrete 1/30 RawV4LBuffer: Selected format: YUYV RawV4LBuffer: Getting format (VIDIOC_G_FMT) RawV4LBuffer: size: 640x480 RawV4LBuffer: format: YUYV RawV4LBuffer: field flag: 1 RawV4LBuffer: bytes per line: 1280 RawV4LBuffer: image size: 614400 RawV4LBuffer: colourspace: 8 RawV4LBuffer: Setting format (VIDIOC_S_FMT) RawV4LBuffer: size: 640x480 RawV4LBuffer: format: YUYV RawV4LBuffer: field flag: 0 RawV4LBuffer: bytes per line: 1280 RawV4LBuffer: image size: 614400 RawV4LBuffer: colourspace: 8 RawV4LBuffer: Getting format (VIDIOC_G_FMT) RawV4LBuffer: size: 640x480 RawV4LBuffer: format: YUYV RawV4LBuffer: field flag: 1 RawV4LBuffer: bytes per line: 1280 RawV4LBuffer: image size: 614400 RawV4LBuffer: colourspace: 8 RawV4LBuffer: Issuing VIDIOC_REQBUFS ioctl. RawV4LBuffer: Return code: 0 RawV4LBuffer: Number of buffers: 10 FPS: 0 inf Size: [640 480] N3CVD9V4LBufferINS_6yuv422EEE Using V4LBuffer. frame size: [640 480]

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/edrosten/libcvd/issues/19#issuecomment-221933064

HDaoud commented 8 years ago

I got this error with 420p Error: V4LBuffer cannot handle types other than byte, bayer, yuv422, vuy422, Rgb<byte> maybe it's still using the old files before re-initiating yuv420p

EDIT: this is strange, as I can see my addedd log<< commands in the output, meaning it's using the latest compiled file which supposed to be recognizing the yuv420! :confused:

HDaoud commented 8 years ago

it worked well with my webcam on /dev/video0 (seems it's also yuv422)

Just to let you know why I'm using the virtual loopback, as when trying to read directly from the decoded frames that I'm writing to fifo file, I got ioctl error:

'#progs/video_play_source colourspace:[from=yuv422]//v4l2:[verbose]///video_decoded_fifo RawV4LBuffer: verbose operation. Initializing RawV4LBuffer: Querying capabilities. Error: V4LBuffer: "V4L2: VIDIOC_QUERYCAP failed" ioctl failed on /video_decoded_fifo: Inappropriate ioctl for device

edrosten commented 8 years ago

Can you check without using colourspacebuffer?

Also, yes, you can't run vrl2buffer on raw files, it's designed for v4l2 capture devices only. Where did the raw file dump come from?

-Ed

On 26 May 2016 at 18:27, HDaoud notifications@github.com wrote:

I got this error with 420p Error: V4LBuffer cannot handle types other than byte, bayer, yuv422, vuy422, Rgb maybe it's still using the old files before re-initiating yuv420p

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/edrosten/libcvd/issues/19#issuecomment-221938571

HDaoud commented 8 years ago

Results without colourspace:

progs/video_play_source v4l2:[verbose]///dev/video2 RawV4LBuffer: verbose operation. Initializing RawV4LBuffer: Querying capabilities. RawV4LBuffer: driver: v4l2 loopback RawV4LBuffer: card: Dummy video device (0x0000) RawV4LBuffer: bus_info: platform:v4l2loopback-000 RawV4LBuffer: version: 200711 RawV4LBuffer: capabilities: 0x85008003 RawV4LBuffer: V4L2_CAP_VIDEO_CAPTURE = 1 RawV4LBuffer: V4L2_CAP_VIDEO_OUTPUT = 1 RawV4LBuffer: V4L2_CAP_VIDEO_OVERLAY = 0 RawV4LBuffer: V4L2_CAP_VBI_CAPTURE = 0 RawV4LBuffer: V4L2_CAP_VBI_OUTPUT = 0 RawV4LBuffer: V4L2_CAP_SLICED_VBI_CAPTURE = 0 RawV4LBuffer: V4L2_CAP_SLICED_VBI_OUTPUT = 1 RawV4LBuffer: V4L2_CAP_RDS_CAPTURE = 0 RawV4LBuffer: V4L2_CAP_VIDEO_OUTPUT_OVERLAY = 0 RawV4LBuffer: V4L2_CAP_TUNER = 1 RawV4LBuffer: V4L2_CAP_AUDIO = 0 RawV4LBuffer: V4L2_CAP_RADIO = 0 RawV4LBuffer: V4L2_CAP_READWRITE = 1 RawV4LBuffer: V4L2_CAP_ASYNCIO = 0 RawV4LBuffer: V4L2_CAP_STREAMING = 1 RawV4LBuffer: Requested format: RGB3 RawV4LBuffer: Enumerating formats. RawV4LBuffer: Index FourCC Flag Description RawV4LBuffer: 0 YU12 0x00000000 [YU12] RawV4LBuffer: frame size discrete 640x368 RawV4LBuffer: rate discrete 1/30 RawV4LBuffer: Selected format: None Error: V4LBuffer: No colourspace on /dev/video2 matching None

HDaoud commented 8 years ago

For some reason with yuv420p format, the ioctl is not returning 0, thus It's not entering the loop and enumerating through the formats.

and this has to do with also video_play_source not recognizing the yuv420.

HDaoud commented 8 years ago

Ah no sorry, it's entering

RawV4LBuffer: 0 YU12 0x00000000 [YU12] RawV4LBuffer: frame size discrete 640x368 RawV4LBuffer: rate discrete 1/30

but based on my added log<<... code, fmt == V4L2_PIX_FMT_GREY never true

edrosten commented 8 years ago

Ah cool. Looks like 420p wandered off. Try the latest commit.

-Ed

On 26 May 2016 at 18:49, HDaoud notifications@github.com wrote:

Ah no sorry, it's entering

RawV4LBuffer: 0 YU12 0x00000000 [YU12] RawV4LBuffer: frame size discrete 640x368 RawV4LBuffer: rate discrete 1/30

but based on my added log<<... code, fmt == V4L2_PIX_FMT_GREY never true

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/edrosten/libcvd/issues/19#issuecomment-221944340

HDaoud commented 8 years ago

I removed fmt == V4L2_PIX_FMT_GREY and I can see the video, but it immediately close with segmentation fault., also the video content is shown multiple time (two rows, 3 up and 3 down) meaning the colourspace is not rendering correctly.

HDaoud commented 8 years ago

ok, now when I put the colourspace of 422 which is wrong ofcourse as it's not accepting the 420p it plays nicely with wrong colors but no errors :smiley: I will try to download the latest commit and test, but need to remove fmt == V4L2_PIX_FMT_GREY

HDaoud commented 8 years ago

:laughing: I downloaded the latest commit, and #It's Running Perfectly :smile:

HDaoud commented 8 years ago

Thank you Edward so much, now I have to change the camera settings to work with videoBuffer

HDaoud commented 8 years ago

Just for reference: The Camera Calibrator and PTAMM will work on their default settings with v4lbuffer, without changing to videobuffer.

also the loop in v4lbuffer.cc is working without removing fmt==V4L2_PIX_FMT_GREY

Thank you again Edward for your time and efforts.