V4L2 中error 22, Invalid argument的解决方法
来源:互联网 发布:华为手机查看网络制式 编辑:程序博客网 时间:2024/05/22 04:53
Error: pixel format not supported
error 22, Invalid argument
我的摄像头是笔记本上自带的,用命令lsusb看到的情况如下:
Bus 002 Device 003: ID 17ef:4808 Lenovo
这个问题很多人遇到过,原因是采取的编码与设备的支持的编码不兼容
以我的环境为例,我在代码中设定的编码格式为:
fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUV420
可以使用函数返回设备支持的pixel format:
ioctl(fd, VIDIOC_ENUM_FMT, &fmt1)
struct v4l2_fmtdesc fmt;int ret;memset(&fmt, 0, sizeof(fmt));fmt.index = 0;fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;while ((ret = ioctl(fd, VIDIOC_ENUM_FMT, fmt)) == 0) //查看编码格式{fmt.index++;printf("pixelformat is '%c%c%c%c', description is '%s' \n",fmt.pixelformat & 0xFF, (fmt.pixelformat >> 8) & 0xFF, (fmt.pixelformat >> 16) & 0xFF, (fmt.pixelformat >> 24) & 0xFF,fmt.description); }
pixelformat is 'YUYV', description is 'YUV 4:2:2 (YUYV)'
把上面的
fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUV420
改为fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV 即可。不过需要明白,YUV420和YUYV的编码格式不同,后面处理码流也要相对于的变化。
通过
- V4L2 中error 22, Invalid argument的解决方法
- V4L2 ,VIDIOC_DQBUF,Invalid argument
- eclipse termios.error: (22, 'Invalid argument')
- Error: Invalid argument: /X
- transfer error: Invalid argument
- accept error: Invalid argument
- “VMware: vmw_ioctl_command error Invalid argument.
- Warning: Invalid argument supplied for foreach() in 的解决方法
- delphi ”invalid argument to date encode“的解决方法
- linux系统fdisk报错:error 22: Invalid argument
- linux系统fdisk报错error 22: Invalid argument解决办法
- transfer error: Invalid argument. Failed to push selection: Invalid argument
- Error:dojo.data.ItemFileWriteStore:Invalid item argument
- Error while creating directories: Invalid argument
- Qt Createor error writing to -: Invalid argument
- Qt Createor error writing to -: Invalid argument
- Invalid argument supplied for foreach() 解决方法
- 【原创】QT:编译时出现 “error: error writing to -: Invalid argument”错误的解决
- RGB16转换RGB24
- Hibernate自身双向一对多关联
- 設置窗口及按鈕背景圖片
- xcode制作和使用静态库
- 关于谷歌地图API程序的一些预想
- V4L2 中error 22, Invalid argument的解决方法
- Android Intent 用法全面总结
- Windows的系统信息
- shell中并,或的用法
- Stagefright 之 AudioPlayback的流程
- linux中的MBR记录详解
- microstation 中的椭圆旋转参数说明
- HttpClient和HtmlParser简介(转)
- SAP中关于用户IP信息的获取(转载)