I am getting started with the V4L2 framework on Ubuntu 10.4.
我开始使用ubuntu10.4上的V4L2框架。
currently I am using an webcam to do some tests. I am following this documentation to start, the installation was worked fine. I downloaded and compiled the application example. The problems is video output,I call the executable using:
目前我正在使用网络摄像头做一些测试。我正在跟踪这个文档开始,安装工作正常。我下载并编译了应用程序示例。问题是视频输出,我调用可执行文件使用:
# modprobe -r pwc
# modprobe -v pwc fps=15 compression=3 mbufs=4 fbufs=4 size=vga
# ./capturer_mmap -D /dev/video0 -w 640*480 -p 0 | ./viewer -w 640*480 -p 0
given this output:
鉴于这种输出:
Output on terminal:
输出终端:
window size 640*480
Video bytespreline = 1280
Display:
Image byte order = LSBFirst
Bitmap unit = 32
Bitmap bit order = LSBFirst
Bitmap pad = 32
Window:
Depth = 24
Red mask = 0x00ff0000
Green mask = 0x0000ff00
Blue mask = 0x000000ff
Bits per R/G/B = 8
Image byte order = LSBFirst
Bitmap unit = 32
Bitmap bit order = LSBFirst
Bitmap pad = 32
Depth = 24
Red mask = 0x00ff0000
Green mask = 0x0000ff00
Blue mask = 0x000000ff
Bits per pixel = 32
Bytes per line = 2560
IsShared = True
XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":0.0"
after 431 requests (19 known processed) with 0 events remaining.
root@my-laptop:/home/foo/V4l2_samples-0.4.1# ./capturer_mmap -D /dev/video0 -w 640*480 -p 0 | ./viewer -w 640*480 -p 0
window size 640*480
Video bytespreline = 1280
Display:
Image byte order = LSBFirst
Bitmap unit = 32
Bitmap bit order = LSBFirst
Bitmap pad = 32
Window:
Depth = 24
Red mask = 0x00ff0000
Green mask = 0x0000ff00
Blue mask = 0x000000ff
Bits per R/G/B = 8
Image byte order = LSBFirst
Bitmap unit = 32
Bitmap bit order = LSBFirst
Bitmap pad = 32
Depth = 24
Red mask = 0x00ff0000
Green mask = 0x0000ff00
Blue mask = 0x000000ff
Bits per pixel = 32
Bytes per line = 2560
IsShared = True
XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":0.0"
after 101 requests (19 known processed) with 0 events remaining.
I have no idea how to fix this. I belive the probrem is in C code because I can to use webcam with Webcam Chesse application. Any help is very appreciated. Thanks a lot!
我不知道该怎么解决这个问题。我相信probrem在C代码中,因为我可以使用webcam Chesse应用程序。非常感谢您的帮助。谢谢!
1 个解决方案
#1
2
it looks like you are displaying the image in a completely wrong format.
看起来你是在以完全错误的格式显示图像。
when working with v4l2, you should definitely check out "libv4l" (packaged in debian, so also available in ubuntu). v4l2 allows a device to output it's frames in any of a very large number of video-formats, some of those are compressed (e.g. using jpeg). core v4l2 does not provide any means to convert the image into a given format your application supports, so in theory your application must support all possible formats.
在使用v4l2时,一定要检查“libv4l”(在debian中打包,在ubuntu中也可以使用)。v4l2允许设备输出大量视频格式中的帧,其中一些是压缩的(例如使用jpeg)。core v4l2不提供将映像转换为应用程序支持的给定格式的任何方法,因此理论上,应用程序必须支持所有可能的格式。
in order to avoid code duplication (each v4l2-capable application faces the same problem!), libv4l was created: it allows low-level access to the device, but at the sametime guarantees that the frame can be access using a few standard formats. e.g. if the device only supports jpeg-output and your app requests RGB32 frames, libv4l will transparently convert for you.
为了避免代码重复(每个支持v42的应用程序都面临相同的问题!)例如,如果设备只支持jpeg-output,而您的应用程序请求RGB32帧,那么libv4l将为您透明地进行转换。
you can even use libv4l with some LD_PRELOAD tricks, in order to make it work with applications that have been compiled without libv4l-support (just to check whether my suggestion makes sense)
您甚至可以使用libv4l和一些LD_PRELOAD技巧来使用libv4l,以便在不支持libv4l的情况下编译的应用程序中使用它(只是为了检查我的建议是否有意义)
#1
2
it looks like you are displaying the image in a completely wrong format.
看起来你是在以完全错误的格式显示图像。
when working with v4l2, you should definitely check out "libv4l" (packaged in debian, so also available in ubuntu). v4l2 allows a device to output it's frames in any of a very large number of video-formats, some of those are compressed (e.g. using jpeg). core v4l2 does not provide any means to convert the image into a given format your application supports, so in theory your application must support all possible formats.
在使用v4l2时,一定要检查“libv4l”(在debian中打包,在ubuntu中也可以使用)。v4l2允许设备输出大量视频格式中的帧,其中一些是压缩的(例如使用jpeg)。core v4l2不提供将映像转换为应用程序支持的给定格式的任何方法,因此理论上,应用程序必须支持所有可能的格式。
in order to avoid code duplication (each v4l2-capable application faces the same problem!), libv4l was created: it allows low-level access to the device, but at the sametime guarantees that the frame can be access using a few standard formats. e.g. if the device only supports jpeg-output and your app requests RGB32 frames, libv4l will transparently convert for you.
为了避免代码重复(每个支持v42的应用程序都面临相同的问题!)例如,如果设备只支持jpeg-output,而您的应用程序请求RGB32帧,那么libv4l将为您透明地进行转换。
you can even use libv4l with some LD_PRELOAD tricks, in order to make it work with applications that have been compiled without libv4l-support (just to check whether my suggestion makes sense)
您甚至可以使用libv4l和一些LD_PRELOAD技巧来使用libv4l,以便在不支持libv4l的情况下编译的应用程序中使用它(只是为了检查我的建议是否有意义)