gpt4 book ai didi

使用 V4L2 捕获网络摄像头流失败

转载 作者:太空狗 更新时间:2023-10-29 12:20:46 26 4
gpt4 key购买 nike

我开始使用 Ubuntu 10.4 上的 V4L2 框架。

目前我正在使用网络摄像头进行一些测试。我正在关注 this文档开始,安装工作正常。我下载并编译了应用示例。问题是视频输出,我调用可执行文件使用:

# 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

给定这个输出:

enter image description here

终端输出:

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.

我不知道如何解决这个问题。我相信问题出在 C 代码中,因为我可以将网络摄像头与 Webcam Chesse 应用程序一起使用。非常感谢任何帮助。非常感谢!

最佳答案

看起来您正在以完全错误的格式显示图像。

在使用 v4l2 时,您一定要查看“libv4l”(打包在 debian 中,因此在 ubuntu 中也可用)。 v4l2 允许设备以大量视频格式中的任何一种输出其帧,其中一些是压缩的(例如使用 jpeg)。core v4l2 不提供任何方法将图像转换为您的应用程序支持的给定格式,因此理论上您的应用程序必须支持所有可能的格式。

为了避免代码重复(每个支持 v4l2 的应用程序都面临同样的问题!),创建了 libv4l:它允许对设备进行低级访问,但同时保证可以使用一些标准格式。例如如果设备仅支持 jpeg 输出并且您的应用程序请求 RGB32 帧,libv4l 将透明地为您转换。

您甚至可以将 libv4l 与一些 LD_PRELOAD 技巧一起使用,以使其适用于在没有 libv4l-support 的情况下编译的应用程序(只是为了检查我的建议是否有意义)

关于使用 V4L2 捕获网络摄像头流失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9450257/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com