Ask Your Question

Revision history [back]

libv4l unable convert to requested pixfmt

hello

I tray to open my camera by opencv but see this error:

HIGHGUI ERROR: libv4l unable convert to requested pixfmt
HIGHGUI ERROR: libv4l unable to ioctl VIDIOCSPICT

My Code:

   VideoCapture cap(1)
   // Check if camera opened successfully
  if(!cap.isOpened())
  {
    cout << "Error opening video stream" << endl;
    return -1;
  }

my v4l2-ctl out put:

$ v4l2-ctl -d1 --get-fmt-video
Format Video Capture:

    Width/Height  : 720/480
    Pixel Format  : 'NV12'
    Field         : None
    Bytes per Line: 720
    Size Image    : 518400
    Colorspace    : Broadcast NTSC/PAL (SMPTE170M/ITU601)

$ v4l2-ctl -d1 --list-formats

ioctl: VIDIOC_ENUM_FMT

    Index       : 0
    Type        : Video Capture
    Pixel Format: 'NV12'
    Name        : planar YUV420 - NV12

    Index       : 1
    Type        : Video Capture
    Pixel Format: 'NV16'
    Name        : planar YUV422 - NV16

But ffmpeg working good!

ffmpeg -f v4l2 -standard pal -s 720x576 -pix_fmt nv12 -r 25 -i /dev/video1 mn123.mpg

how to solve this problem?

thanks