def probe(self):
		""" Probe the video device to get height and width info """

		vd = open(self.device_name, 'r')
		fmt = v4l2.v4l2_format()
		fmt.type = v4l2.V4L2_BUF_TYPE_VIDEO_CAPTURE
		ret = fcntl.ioctl(vd, v4l2.VIDIOC_G_FMT, fmt)
		vd.close()
		if ret == 0:
			height = fmt.fmt.pix.height
			width = fmt.fmt.pix.width
		else:
			# Could not determine the resolution from ioctl call. Reverting to slower ffmpeg.probe() method
			import ffmpeg
			probe = ffmpeg.probe(self.device_name)
			height = int(probe['streams'][0]['height'])
			width = int(probe['streams'][0]['width'])

		if self.get(CAP_PROP_FRAME_HEIGHT) == 0:
			self.set(CAP_PROP_FRAME_HEIGHT, int(height))

		if self.get(CAP_PROP_FRAME_WIDTH) == 0:
			self.set(CAP_PROP_FRAME_WIDTH, int(width))
 Probe the video device to get height and width info 
howdy/src/recorders/pyv4l2_reader.py