Skip to content Skip to sidebar Skip to footer

V4l2 Fcntl.ioctl Vidioc_s_parm For Setting Fps And Resolution Of Camera Capture

I am trying to set fps and resolution of webcam and capture from it via v4l2 Python. v4l2 Python documentation is limited to ; >>> import v4l2 >>> import fcntl &g

Solution 1:

From the V4L2 side, you need to:

  • use the VIDIOC_G_PARM ioctl and check the v4l2_streamparm.parm.capture.capability member to find out whether the driver allows V4L2_CAP_TIMEPERFRAME.
  • if so, use the VIDIOC_ENUM_FRAMEINTERVALS ioctl to get the list of possible frame intervals (inverse of framerates), in the form of v4l2_fract structures
  • use these values with the VIDIOC_S_PARM ioctl and fill in the v4l2_streamparm.parm.capture.timeperframe member.

That should allow setting the capture-side frame rate. It's your task to make sure you're reading fast enough not to get frame drops.

Post a Comment for "V4l2 Fcntl.ioctl Vidioc_s_parm For Setting Fps And Resolution Of Camera Capture"