MJPG使用Raspberry Pi和网络摄像头进行流式传输

时间:2012-11-18 03:38:39

标签: video-streaming webcam raspberry-pi

所以我需要使用Raspberry pi的网络摄像头,并遵循this教程。设备正在为测试流页面提供服务,但是应该嵌入流的所有位置都是空白的。我正在使用带有Raspbian Wheezy发行版的PS3 eyetoy相机。这是启动服务器时收到的日志:

MJPG Streamer Version: svn rev: 3:165
 i: Using V4L2 device.: /dev/video0
 i: Desired Resolution: 640 x 480
 i: Frames Per Second.: 5
 i: Format............: MJPEG
Adding control for Pan (relative)
UVCIOC_CTRL_ADD - Error: Inappropriate ioctl for device
Adding control for Tilt (relative)
UVCIOC_CTRL_ADD - Error: Inappropriate ioctl for device
Adding control for Pan Reset
UVCIOC_CTRL_ADD - Error: Inappropriate ioctl for device
Adding control for Tilt Reset
UVCIOC_CTRL_ADD - Error: Inappropriate ioctl for device
Adding control for Pan/tilt Reset
UVCIOC_CTRL_ADD - Error: Inappropriate ioctl for device
Adding control for Focus (absolute)
UVCIOC_CTRL_ADD - Error: Inappropriate ioctl for device
mapping control for Pan (relative)
UVCIOC_CTRL_MAP - Error: Inappropriate ioctl for device
mapping control for Tilt (relative)
UVCIOC_CTRL_MAP - Error: Inappropriate ioctl for device
mapping control for Pan Reset
UVCIOC_CTRL_MAP - Error: Inappropriate ioctl for device
mapping control for Tilt Reset
UVCIOC_CTRL_MAP - Error: Inappropriate ioctl for device
mapping control for Pan/tilt Reset
UVCIOC_CTRL_MAP - Error: Inappropriate ioctl for device
mapping control for Focus (absolute)
UVCIOC_CTRL_MAP - Error: Inappropriate ioctl for device
mapping control for LED1 Mode
UVCIOC_CTRL_MAP - Error: Inappropriate ioctl for device
mapping control for LED1 Frequency
UVCIOC_CTRL_MAP - Error: Inappropriate ioctl for device
mapping control for Disable video processing
UVCIOC_CTRL_MAP - Error: Inappropriate ioctl for device
mapping control for Raw bits per pixel
UVCIOC_CTRL_MAP - Error: Inappropriate ioctl for device
 o: www-folder-path...: ./www/
 o: HTTP TCP port.....: 8080
 o: username:password.: disabled
 o: commands..........: enabled

我没有找到任何关于此错误的解释,也不知道它可能指的是什么问题。

2 个答案:

答案 0 :(得分:10)

ps3相机似乎不支持mjpeg,但它确实支持YUYV格式。尝试使用-y标志初始化流。例如:

mjpg_streamer -i "/usr/lib/input_uvc.so -d /dev/video0 -y  -r 320x240 -f 15" -o "/usr/lib/output_http.so -p 8090 -w ./www"

答案 1 :(得分:5)

根据我的经验,您列出的错误与Linux-UVC驱动程序的dynctrls有关,而与图像格式mjpeg或yuyv无关。

好像你的相机确实支持mjpeg格式,但是,你当前的相机/驱动程序缺乏对所列dynctrls的支持(即你的相机无法进行摇摄/倾斜/聚焦等,或遇到mjpeg尝试访问/设置列出的控件时出错,您可以禁用dynctrls(因此可以在启动mjpg-streamer时消除使用-n标志收到的错误。

这样的事情:

./mjpg_streamer -i "./input_uvc.so -d /dev/video0 -n" -o "./output_http.so -p 8090"

将在raspberry pi的ip地址的端口8090上开始流式传输。

要访问本地网络上的流,请转到xxx.xxx.xxx.xxx:8090/?action=stream或将<img src="xxx.xxx.xxx.xxx:8090/?action=stream">插入可访问的html页面。将xxx.xxx.xxx.xxx替换为覆盆子pi的LOCAL IP地址。

要在远程位置访问流(不是与pi在同一本地网络上),请将xxx.xxx.xxx.xxx替换为覆盆子pi所在网络的外部IP(并编辑路由器设置以转发请求)将8090移植到raspberry pi的LOCAL IP地址)。