有谁知道v4l2和mjpg-mjpg streamer 移植的联系么

有谁知道v4l2和mjpg-streamer的联系么_百度知道
有谁知道v4l2和mjpg-streamer的联系么
其他类似问题
为您推荐:
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁Ubuntu下mjpg-streamer 安装_Linux教程_Linux公社-Linux系统门户网站
你好,游客
Ubuntu下mjpg-streamer 安装
来源:Linux社区&
作者:firefoxbug
mjpg-streamer 源码[ ~]# svn co https://mjpg-streamer.svn.sourceforge.net/svnroot/mjpg-streamer mjpg-streamer
[ mjpg-streamer]# ls -l总用量 24drwxr-xr-x. 3 root root 4096 4月 29 11:31 docdrwxr-xr-x. 4 root root 4096 4月 29 11:31 mjpeg-clientdrwxr-xr-x. 6 root root 4096 4月 29 11:31 mjpg-streamerdrwxr-xr-x. 6 root root 4096 4月 29 11:31 mjpg-streamer-experimentaldrwxr-xr-x. 3 root root 4096 4月 29 11:31 udp_clientdrwxr-xr-x. 3 root root 4096 4月 29 17:07 uvc-streamer
编译:[ mjpg-streamer/mjpg-streamer-experimental]# make
[ mjpg-streamer/uvc-streamer]# make (这里会编译下面的所有组件)
这里可能会出现错误,显示linux/videodev.h找不到,这是因为内核版本太高的原因,videodev.h这个接口不支持了。具体解决方案google下就可以了。我后来是换了 10.10然后就能顺利配置了。
[ mjpg-streamer/mjpg-streamer-experimental]# ./start.sh
如果启动后显示
Unable to set format: Invalid argumentInit v4L2 failed !! exit fatal i: init_VideoIn failed
查看http://www.firefoxbug.net/?p=942
查看视频流本机查看输入 http://localhost:8080/
其它电脑查看输入:& http://本机ip:8080/
相关资讯 & & &
& (01/14/:19)
& (12/23/:35)
& (11/29/:27)
& (12/24/:28)
& (12/03/:14)
& (11/27/:09)
图片资讯 & & &
   同意评论声明
   发表
尊重网上道德,遵守中华人民共和国的各项有关法律法规
承担一切因您的行为而直接或间接导致的民事或刑事法律责任
本站管理人员有权保留或删除其管辖留言中的任意内容
本站有权在网站内转载或引用您的评论
参与本评论即表明您已经阅读并接受上述条款主题 : 为什么使用mjpg-streamer拍照得到的图像最大只能是640x480?
级别: 新手上路
金钱: 205 两
威望: 41 点
贡献值: 0 点
综合积分: 82 分
&为什么使用mjpg-streamer拍照得到的图像最大只能是640x480?
我用mjpg-streamer使用usb罗技920摄像头1000w像素的,但是执行的时候出现下面的情况:MJPG Streamer Version.: 2.0 i: Using V4L2 device.: /dev/video2 i: Desired Resolution: 1028 x 760 i: Frames Per Second.: 15 i: Format............: MJPG format asked unavailable get width 640 height 480 o: www-folder-path...: ./www/ o: HTTP TCP port.....: 8080 o: username:password.: disabled o: commands..........: enabled o: output folder.....: pics o: delay after save..: 5000 o: picture diff-bytes: 0 o: command...........: disabled把获取的图片传到pc机上查看,是640x480的图片,但我想获得高像素的图片,请各位大侠帮忙解决一下问题,感激不尽!
自由,自强,共享,共创。
级别: 论坛版主
发帖: 8889
金钱: 46370 两
威望: 9274 点
贡献值: 27 点
综合积分: 18318 分
自己看看mjpeg源代码了
新手如何向我们反馈有效的信息,以便解决问题,见此贴: [注]: 此处签名链接仅为指引方向,而非解答问题本身.
级别: 新手上路
金钱: 205 两
威望: 41 点
贡献值: 0 点
综合积分: 82 分
看了真不知道哪里出错,水平有限,望版主讲解一下!谢谢!
级别: 新手上路
金钱: 205 两
威望: 41 点
贡献值: 0 点
综合积分: 82 分
有没有人帮忙回答一下!
级别: 新手上路
金钱: 115 两
威望: 23 点
贡献值: 0 点
综合积分: 46 分
你用的什么板子,估计是板子的是usb1.0的吧,传输压缩后的mjpg也就640x480差不多了。欢迎交流QQ:
Powered by只需一步,快速开始
后使用快捷导航没有帐号?
查看: 2771|回复: 5
mjpg_streamer -i &/lib/input_uvc.so& -o &/lib/output_http.so -w 192.168.40.5
MJPG-streamer [872]: starting application
MJPG Streamer Version.: 2.0
MJPG-streamer [872]: MJPG Streamer Version.: 2.0
i: Using V4L2 device.: /dev/video0
MJPG-streamer [872]: Using V4L2 device.: /dev/video0
i: Desired Resolution: 640 x 480
MJPG-streamer [872]: Desired Resolution: 640 x 480
i: Frames Per Second.: 5
MJPG-streamer [872]: Frames Per Second.: 5
i: Format............: MJPEG
MJPG-streamer [872]: Format............: MJPEG
o: www-folder-path...: 192.168.40.59:8080/
MJPG-streamer [872]: www-folder-path...: 192.168.40.59:8080/
o: HTTP TCP port.....: 8080
MJPG-streamer [872]: HTTP TCP port.....: 8080
o: username:password.: disabled
MJPG-streamer [872]: username:password.: disabled
o: commands..........: enabled
MJPG-streamer [872]: commands..........: enabled
MJPG-streamer [872]: starting input plugin
Segmentation fault
libjpeg库和SDL库都齐全,一直搞不懂是什么原因
这个问题我已经找到解决方法,像其他普通的input-plugin一样,input plugin是把JPEG格式的图片拷贝到全局可访问内存中,接着给等待进程发送信号,由于拷贝到的内存越界,导致段错误。解决方法:在linux bootoption中加上mem=64M,限制内存区,就不会越界了。就这么一个小错误,困扰了几天,曾今想放弃了
楼主威武!
&在linux bootoption中加上mem=64M,限制内存区,就不会越界了&& & LZ这个可以详细点吗& &&&我没有设置过bootoption& & 可是遇到类似的问题
[root@EmbedSky /]# mjpg_streamer -i &/lib/WebCam/input_cmoscamera.so -r 320x256&
-o &/lib/WebCam/output_http.so -w 192.168.1.122:8080&
MJPG-streamer [483]: starting application
MJPG Streamer Version: svn rev: exported
MJPG-streamer [483]: MJPG Streamer Version: svn rev: exported
i: Using CMOS Camera device.: /dev/camera
MJPG-streamer [483]: Using CMOS Camera device.: /dev/camera
i: Desired Resolution: 640 x 512
MJPG-streamer [483]: Desired Resolution: 640 x 512
i: Frames Per Second.: 5
MJPG-streamer [483]: Frames Per Second.: 5
i: Format............: YUV
MJPG-streamer [483]: Format............: YUV
i: JPEG Quality......: 80
MJPG-streamer [483]: JPEG Quality......: 80
o: www-folder-path...: 192.168.1.122:8080/
MJPG-streamer [483]: www-folder-path...: 192.168.1.122:8080/
o: HTTP TCP port.....: 8080
MJPG-streamer [483]: HTTP TCP port.....: 8080
o: username:password.: disabled
MJPG-streamer [483]: username:password.: disabled
o: commands..........: enabled
MJPG-streamer [483]: commands..........: enabled
MJPG-streamer [483]: starting input plugin /lib/WebCam/input_cmoscamera.so
i: cleaning up ressources allocated by input thread
MJPG-streamer [483]: cleaning up ressources allocated by input thread
Segmentation fault
把www拷贝到根目录,然后
执行mjpg_streamer -i &/lib/WebCam/input_cmoscamera.so -r 320x256&&&-o &/lib/WebCam/output_http.so -w /www&
就可以了,不过有些浏览器不行,
注意USB摄像头是执行mjpg_streamer -i &/lib/WebCam/input_uvc.so& -o &/lib/WebCam/output_http.so -w&&/www &
在PC的浏览器中 或者或者 即可以看监控内容
以上内容摘自笔者实验环境,不同的环境请做适当的修改,如IP或者mjpg_streamer后面的参数请按照当时的环境为准
谢谢LS的版主& &原来的问题解决了&&是由于SDL库不匹配引起的
用浏览器的话,不知道为什么只能静态的图片,需要刷新,不能视频流
Powered by下次自动登录
现在的位置:
& 综合 & 正文
mjpg-streamer结构和mjpg_streamer.c与mjpg_streamer.h文件分析
http://www.friendlyarm.net/forum/topic/279?lang=en
/p/mjpg-streamer-mini2440/
/p/mjpg-streamer-mini2440/source/checkout
下载mjpg_streamer源码并观察源码结构如下
[root@localhost tmp]# svn checkout
mjpg-streamer-mini2440-read-only
[root@localhost tmp]# cd mjpg-streamer-mini2440-read-only/
[root@localhost mjpg-streamer-mini2440-read-only]# pwd
/tmp/mjpg-streamer-mini2440-read-only
[root@localhost mjpg-streamer-mini2440-read-only]# tree
|-- CHANGELOG
|-- LICENSE
|-- Makefile
|-- README
|-- mjpg-streamer-mini2440.kdev4
|-- mjpg_streamer.c
|-- mjpg_streamer.h
|-- plugins
|-- input.h
|-- input_control|
|-- Makefile
|-- dynctrl.c
|-- dynctrl.h
|-- input_uvc.c
|-- uvc_compat.h
`-- uvcvideo.h
|-- input_file
|-- Makefile
`-- input_file.c
|-- input_gspcav1
|-- Makefile
|-- encoder.c
|-- encoder.h
|-- huffman.c
|-- huffman.h
|-- input_gspcav1.c
|-- jconfig.h
|-- jdatatype.h
|-- marker.c
|-- marker.h
|-- quant.c
|-- quant.h
|-- readme.spcacat
|-- spcaframe.h
|-- spcav4l.c
|-- spcav4l.h
|-- utils.c
`-- utils.h
|-- input_s3c2410
|-- Makefile
|-- input_s3c2410.c
|-- readme.s3c2410
|-- s3c2410.c
|-- s3c2410.h
|-- utils.c
`-- utils.h
|-- input_testpicture
|-- Makefile
|-- input_testpicture.c
|-- pictures
|-- 160x120_1.jpg
|-- 160x120_2.jpg
|-- 320x240_1.jpg
|-- 320x240_2.jpg
|-- 640x480_1.jpg
|-- 640x480_2.jpg
|-- 960x720_1.jpg
`-- 960x720_2.jpg
`-- testpictures.h
|-- input_uvc|
|-- Makefile
|-- dynctrl.c
|-- dynctrl.h
|-- huffman.h
|-- input_uvc.c
|-- jpeg_utils.c
|-- jpeg_utils.h
|-- uvc_compat.h
|-- uvcvideo.h
|-- v4l2uvc.c
`-- v4l2uvc.h
|-- output.h
|-- output_autofocus
|-- Makefile
|-- output_autofocus.c
|-- processJPEG_onlyCenter.c
`-- processJPEG_onlyCenter.h
|-- output_file
|-- Makefile
`-- output_file.c
`-- output_http
|-- Makefile
|-- httpd.c
|-- httpd.h
`-- output_http.c
|-- simplified_jpeg_encoder.c
|-- simplified_jpeg_encoder.h
|-- start_s3c2410.sh
|-- start_uvc.sh|-- start_uvc_yuv.sh
|-- utils.c
|-- utils.h
|-- LICENSE.txt
|-- bodybg.gif
|-- cambozola.jar
|-- control.htm
|-- example.jpg
|-- favicon.ico
|-- favicon.png
|-- fix.css
|-- functions.js
|-- index.html
|-- java.html
|-- java_control.html
|-- java_simple.html
|-- javascript.html
|-- javascript_motiondetection.html
|-- javascript_simple.html
|-- sidebarbg.gif
|-- static.html
|-- static_simple.html
|-- stream.html
|-- stream_simple.html
|-- style.css
`-- videolan.html
12 directories, 104 files
[root@localhost mjpg-streamer-mini2440-read-only]#
其中主目录下
|-- start_s3c2410.sh
|-- start_uvc.sh
|-- start_uvc_yuv.sh
这几个脚本用于执行mjpg_streamer并传递参数给main
|-- simplified_jpeg_encoder.c
|-- simplified_jpeg_encoder.h用于对input模块从驱动中取得图像的数据进行编码
mjpg_streamer.h,定义了一个重要的全局结构体globals
mjpg_streamer.c,main函数所在文件,此文件分析启动命令并初始化,并定义静态全局变量 s
plugins/目录下是一些插件,以so文件形式提供,在装载时动态链接。其中
plugins/input_file
plugins/input_gspcav1
plugins/input_s3c2410目录,读取cmos摄像头驱动中的数据,保存到全局变量global
plugins/input_testpictureplugins/input_uvc目录,读取usb摄像头驱动中的数据,保存到全局变量global
plugins/output_autofocus
plugins/output_file目录,用于将图像数据保存到文件plugins/output_http目录,用于监视外部端口(默认8080)的socket请求,将图像数据通过socket发出。即是一个小型web服务器,支持同时发起的xx个链接。
www目录下是几个网页
**************************************************************************************************
对源码试着编译一下---在板子上先插入cmos摄像头,型号0v9650
先修改mjpg_streamer.h,添加DEBUG宏,以便出错时可以知道错在哪里#define DEBUG
再修改Makefile,指定编译器,并指定生成input_s3c2410.so插件
CC = arm-linux-gcc
PLUGINS += input_s3c2410.so
make package
此时会生成mjpg-streamer-mini2440-bin.tar.gz,考到板子上解压后进入它的目录
./start_s3c2410.sh
MJPG Streamer Version.: 2.0
&DBG(input_s3c2410.c, input_init(), 95): argv[0]=S3C2410 embedded camera
&DBG(input_s3c2410.c, input_init(), 169): initializing s3c2410 device
&i: Using V4L2 device.: /dev/video0
&i: Desired Resolution: 640 x 512
&i: Grayscale mode: off
&DBG(s3c2410.c, init_s3c2410(), 63): Opening device
ERROR opening V4L interface
即打开video0时出现问题,修改start_s3c2410.sh ,在-i参数里指定设备文件为/dev/camera,如下
export LD_LIBRARY_PATH="$(pwd)"
./mjpg_streamer -o "output_http.so -w ./www" -i "input_s3c2410.so -d /dev/camera"
再次执行./start_s3c2410.sh
MJPG Streamer Version.: 2.0
&DBG(input_s3c2410.c, input_init(), 95): argv[0]=S3C2410 embedded camera
&DBG(input_s3c2410.c, input_init(), 95): argv[1]=-d
&DBG(input_s3c2410.c, input_init(), 95): argv[2]=/dev/camera
&DBG(input_s3c2410.c, input_init(), 124): case d
&DBG(input_s3c2410.c, input_init(), 169): initializing s3c2410 device
&i: Using V4L2 device.: /dev/camera
&i: Desired Resolution: 640 x 512
&i: Grayscale mode: off
&DBG(s3c2410.c, init_s3c2410(), 63): Opening device
Error opening device /dev/camera: unable to query device.
&i: init_s3c2410 failed
即初始化时出现问题,不能查询设备。
根据提示找到源码s3c2410.c line 63附近
DBG("Opening device\n");//line 63
if ((vd-&fd = open( vd-&videodevice, O_RDWR)) == -1)
exit_fatal ("ERROR opening V4L interface");
memset(&vd-&cap, 0, sizeof(struct v4l2_capability));
err = ioctl(vd-&fd, VIDIOC_QUERYCAP, &vd-&cap);
if (err & 0) {
fprintf(stderr, "Error opening device %s: unable to query device.\n", vd-&videodevice);
可知unable to query device.是由于设备不支持ioctl方法而导致的。
很奇怪哦,怎么友善给的编译好的mjpg-streamer-mini2440-bin-r6.tar.gz放在miroc2440上就可以直接使用,而下载的源码再编译就不可以了呢。。。
发现友善的编译好的是r6版本的,而用svn checkout http://mjpg-streamer-/svn/trunk/ mjpg-streamer-mini2440-read-only下载到的是最新版本,而在最新版本中加入了ioctl方法对摄像头操作。所以要下一个r6版的mjpg-streamer。不必全下,只把r6版的s3c2410.c下载下来替换掉最新版里的s3c2410.c即可。
/p/mjpg-streamer-mini2440/source/browse/trunk/plugins/input_s3c0.c?r=6
再次按照上面所讲编译后下到板子上,执行start_s3c2410.sh,success!如下
[root@FriendlyARM bin6]# ./start_s3c2410.sh
MJPG Streamer Version.: 2.0
DBG(input_s3c2410.c, input_init(), 95): argv[0]=S3C2410 embedded camera
DBG(input_s3c2410.c, input_init(), 95): argv[1]=-d
DBG(input_s3c2410.c, input_init(), 95): argv[2]=/dev/camera
DBG(input_s3c2410.c, input_init(), 124): case d
DBG(input_s3c2410.c, input_init(), 169): initializing s3c2410 device
i: Using V4L2 device.: /dev/camera
i: Desired Resolution: 640 x 512
i: Grayscale mode: off
DBG(s3c2410.c, init_s3c2410(), 45): Opening device
DBG(s3c2410.c, init_s3c2410(), 50): Allocating input buffers
DBG(output_http.c, output_init(), 85): output #00
DBG(output_http.c, output_init(), 118): argv[0]=HTTP output plugin
DBG(output_http.c, output_init(), 118): argv[1]=-w
DBG(output_http.c, output_init(), 118): argv[2]=./www
DBG(output_http.c, output_init(), 176): case 6,7
o: www-folder-path...: ./www/
o: HTTP TCP port.....: 8080
o: username:password.: disabled
o: commands..........: enabled
DBG(mjpg_streamer.c, main(), 374): starting input plugin
我稍微修改过的mjpg-streamer源码
http://download.csdn.net/detail/songqqnew/3841684**************************************************************************************************先看几个结构体
typedef struct _
struct _globals {
//控制读写线程的读写动作进行与否
pthread_mutex_
//互斥量,用于读和写线程的同步
pthread_cond_t
unsigned char *
//全局数据区域,图像数据
//图像数据大小
//输入模块
output out[MAX_OUTPUT_PLUGINS];//输出模块
#define MAX_OUTPUT_PLUGINS 10,可知最多能同时将图像数据输出到10个地方,比如到file,到http
//输出数目,即记录命令参数中有几个 -o
typedef struct _
struct _input {
//so文件名,比如-i "input_s3c2410.so -d& /dev/camera -r 320x240",则plugin="input_s3c2410.so"
input_ //参数
int (*init)(input_parameter *);//初始化函数指针
int (*stop)(void);
//打开函数指针
int (*run)(void);
//执行函数指针
int (*cmd)(in_cmd_type, int);
//命令函数指针
typedef struct _input_parameter input_
struct _input_parameter {
char *parameter_ //比如-i "input_s3c2410.so -d& /dev/camera -r 320x240",则parameter_string="-d& /dev/camera -r 320x240"
struct _globals * //回指全局结构体
typedef struct _
struct _output {
//比如 -o "output_http.so -w ./www",则plugin="output_http.so"
int (*init)(output_parameter *);
int (*stop)(int);
int (*run)(int);
int (*cmd)(int, out_cmd_type, int);
typedef struct _output_parameter output_
struct _output_parameter {
//记录这是第几个输出(-o)
char *parameter_
//比如 -o "output_http.so -w ./www",则parameter_string="-w ./www"
struct _globals *
//回指全局结构体
//mjpg-streamer.c
#include &stdio.h&
#include &stdlib.h&
#include &unistd.h&
#include &string.h&
#include &linux/videodev.h&
#include &sys/ioctl.h&
#include &errno.h&
#include &signal.h&
#include &sys/socket.h&
#include &arpa/inet.h&
#include &sys/types.h&
#include &sys/stat.h&
#include &getopt.h&
#include &pthread.h&
#include &dlfcn.h&
#include &fcntl.h&
#include &syslog.h&
#include "utils.h"
#include "mjpg_streamer.h"
void help(char *progname)
fprintf(stderr, "-----------------------------------------------------------------------\n");
fprintf(stderr, "Usage: %s\n" \
-i | --input \"&input-plugin.so& [parameters]\"\n" \
-o | --output \"&output-plugin.so& [parameters]\"\n" \
" [-h | --help ]........: display this help\n" \
" [-v | --version ].....: display version information\n" \
" [-b | --background]...: fork to the background, daemon mode\n", progname);
fprintf(stderr, "-----------------------------------------------------------------------\n");
fprintf(stderr, "Example #1:\n" \
" To open an UVC webcam \"/dev/video1\" and stream it via HTTP:\n" \
%s -i \"input_uvc.so -d /dev/video1\" -o \"output_http.so\"\n", progname);
fprintf(stderr, "-----------------------------------------------------------------------\n");
fprintf(stderr, "Example #2:\n" \
" To open an UVC webcam and stream via HTTP port 8090:\n" \
%s -i \"input_uvc.so\" -o \"output_http.so -p 8090\"\n", progname);
fprintf(stderr, "-----------------------------------------------------------------------\n");
fprintf(stderr, "Example #3:\n" \
" To get help for a certain input plugin:\n" \
%s -i \"input_uvc.so --help\"\n", progname);
fprintf(stderr, "-----------------------------------------------------------------------\n");
fprintf(stderr, "In case the modules (=plugins) can not be found:\n" \
" * Set the default search path for the modules with:\n" \
export LD_LIBRARY_PATH=/path/to/plugins,\n" \
&&&&推荐文章:
【上篇】【下篇】}

我要回帖

更多关于 树莓派 mjpg streamer 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信