mjpg-streamer:Init v4L2 failed

系统:ubuntu 10.10

启动: ./start.sh

错误内容:

root@fire:~/mjpg-streamer/mjpg-streamer-experimental# ./start.sh
MJPG Streamer Version: svn rev: 3:160
 i: Using V4L2 device.: /dev/video0
 i: Desired Resolution: 640 x 480
 i: Frames Per Second.: -1
 i: Format............: JPEG
Unable to set format: 1196444237 res: 640x480
 Init v4L2 failed !! exit fatal
 i: init_VideoIn failed

错误原因:
市面上大部分摄像头都是支持YUV的,而不是JPEG的。mjpg-stream支持JPEG和YUV两种格式。

[fire@fire mjpg-streamer]$ cd mjpg-streamer-experimental/plugins/input_uvc/
[fire@fire input_uvc]$ vim input_uvc.c

int input_init(input_parameter *param, int id)
{
    char *dev = "/dev/video0", *s;
    int width = 640, height = 480, fps = -1, format = V4L2_PIX_FMT_MJPEG, i;

    /* initialize the mutes variable */
    if(pthread_mutex_init(&cams[id].controls_mutex, NULL) != 0) {
        IPRINT("could not initialize mutex variable\n");
        exit(EXIT_FAILURE);
    }
......................
format = V4L2_PIX_FMT_YUYV
以上就设置了默认的图像格式,重新把模块编译,之后就成功了!

你可能感兴趣的:(SVN,ubuntu,null,vim,input)