Raspberry Pi 1B,mjpg-streamer和USB网络摄像头

时间:2016-07-29 16:29:41

标签: raspberry-pi video-streaming webcam raspbian

我正在使用最新的Raspbian Jessie (2016-05-27)Raspberry Pi 1 Model B (512 Mb)。我正在尝试通过Logitec C270 (usb web cam)mjpg-streamer流式传输视频。

我按照说明here,但它对我不起作用。 我正在使用以下命令启动流服务器并尝试使用分辨率和每秒帧数的不同组合:

/usr/local/bin/mjpg_streamer -i "/usr/local/lib/input_uvc.so -n" -o "/usr/local/lib/output_http.so -p 8888 -w /usr/local/www" &

之后服务器根本没有启动。很快我意识到新内核需要patchnano input_uvc_patch

    --- plugins/input_uvc/input_uvc.c       (revision 174)
+++ plugins/input_uvc/input_uvc.c       (working copy)
@@ -405,9 +405,13 @@
         if(pcontext->videoIn->formatIn == V4L2_PIX_FMT_YUYV) {
             DBG("compressing frame from input: %d\n", (int)pcontext->id);
             pglobal->in[pcontext->id].size = compress_yuyv_to_jpeg(pcontext->videoIn, pglobal->in[pcontext->id].buf, pcontext->videoIn->framesizeIn, gquality);
+            /* copy this frame's timestamp to user space */
+            pglobal->in[pcontext->id].timestamp = pcontext->videoIn->buf.timestamp;
         } else {
             DBG("copying frame from input: %d\n", (int)pcontext->id);
-            pglobal->in[pcontext->id].size = memcpy_picture(pglobal->in[pcontext->id].buf, pcontext->videoIn->tmpbuffer, pcontext->videoIn->buf.bytesused);
+            pglobal->in[pcontext->id].size = memcpy_picture(pglobal->in[pcontext->id].buf, pcontext->videoIn->tmpbuffer, pcontext->videoIn->tmpbytesused);
+            /* copy this frame's timestamp to user space */
+            pglobal->in[pcontext->id].timestamp = pcontext->videoIn->tmptimestamp;
         }

 #if 0
@@ -418,8 +422,6 @@
         prev_size = global->size;
 #endif

-        /* copy this frame's timestamp to user space */
-        pglobal->in[pcontext->id].timestamp = pcontext->videoIn->buf.timestamp;

         /* signal fresh_frame */
         pthread_cond_broadcast(&pglobal->in[pcontext->id].db_update);
Index: plugins/input_uvc/v4l2uvc.c
===================================================================
--- plugins/input_uvc/v4l2uvc.c (revision 174)
+++ plugins/input_uvc/v4l2uvc.c (working copy)
@@ -450,6 +450,8 @@
         */

         memcpy(vd->tmpbuffer, vd->mem[vd->buf.index], vd->buf.bytesused);
+        vd->tmpbytesused = vd->buf.bytesused;
+        vd->tmptimestamp = vd->buf.timestamp;

         if(debug)
             fprintf(stderr, "bytes in used %d \n", vd->buf.bytesused);
Index: plugins/input_uvc/v4l2uvc.h
===================================================================
--- plugins/input_uvc/v4l2uvc.h (revision 174)
+++ plugins/input_uvc/v4l2uvc.h (working copy)
@@ -28,6 +28,7 @@


 #include <stdio.h>
+#include <stdint.h>
 #include <string.h>
 #include <fcntl.h>
 #include <unistd.h>
@@ -105,6 +106,8 @@
     int framecount;
     int recordstart;
     int recordtime;
+    uint32_t tmpbytesused;
+    struct timeval tmptimestamp;
 };

patch -p0 < input_uvc_patch make USE_LIBV4L2=true clean all sudo make install

之后服务器启动,相机上的LED眨了几秒钟。然后我有以下错误:

enter image description here

完整追踪:

Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...
Ignoring empty buffer ...

Message from syslogd@raspberrypi at Jul 29 19:16:24 ...
 kernel:[  150.624402] Internal error: Oops: 5 [#1] ARM

Message from syslogd@raspberrypi at Jul 29 19:16:24 ...
 kernel:[  150.758195] Process systemd-udevd (pid: 116, stack limit = 0xda5ae188)

Message from syslogd@raspberrypi at Jul 29 19:16:24 ...
 kernel:[  150.766538] Stack: (0xda5afd58 to 0xda5b0000)

Message from syslogd@raspberrypi at Jul 29 19:16:24 ...
 kernel:[  150.772716] fd40:                                                       00000142 00000000

Message from syslogd@raspberrypi at Jul 29 19:16:24 ...
 kernel:[  150.784357] fd60: da539000 da5afd8c da5afd84 da5afd78 d6956800 da539000 da5afdb4 da5afd88

Message from syslogd@raspberrypi at Jul 29 19:16:24 ...
 kernel:[  150.795970] fd80: c04c5000 c04ab53c 00000008 7fffffff da539000 da5aff4c da539000 00000000

Message from syslogd@raspberrypi at Jul 29 19:16:24 ...
 kernel:[  150.807600] fda0: 00000142 dbb5c6a4 da5afe14 da5afdb8 c04c5598 c04c4f84 da5afe50 da5afdc4

Message from syslogd@raspberrypi at Jul 29 19:16:24 ...
 kernel:[  150.819330] fdc0: 0000000c da5afe50 da5aff4c 00000008 00000000 da480d00 00000000 00000074

Message from syslogd@raspberrypi at Jul 29 19:16:24 ...
 kernel:[  150.831231] fde0: 00000000 00000000 c047b83c da5aff4c 00000000 00000000 daa11000 00000000

Message from syslogd@raspberrypi at Jul 29 19:16:24 ...
 kernel:[  150.843342] fe00: da5afe30 00000000 da5afe24 da5afe18 c047b3b8 c04c5288 da5aff34 da5afe28

Message from syslogd@raspberrypi at Jul 29 19:16:24 ...
 kernel:[  150.855608] fe20: c047ba70 c047b3a0 c01057dc 00000000 da5f6020 da47b934 192253cf 00000000

Message from syslogd@raspberrypi at Jul 29 19:16:24 ...
 kernel:[  150.868069] fe40: da5afe6c da5afe50 c006634c 00000000 beeeaed4 00000028 80840fb8 0000011a

Message from syslogd@raspberrypi at Jul 29 19:16:24 ...
 kernel:[  150.880651] fe60: da5afe8c 00000000 daa11840 c0107e24 80841fc0 da5b3680 da5afea4 da5affb0

Message from syslogd@raspberrypi at Jul 29 19:16:24 ...
 kernel:[  150.893334] fe80: da5b3680 0000081f 80841fc0 da47b900 00000010 dbb5c6a4 00000000 da5afea8

Message from syslogd@raspberrypi at Jul 29 19:16:24 ...
 kernel:[  150.906203] fea0: c0573cdc c0053218 00000000 fffffff5 00000000 beeeaef4 00000008 00000000

Message from syslogd@raspberrypi at Jul 29 19:16:24 ...
 kernel:[  150.919120] fec0: 00000000 00000000 00000800 00000008 da5afeb4 c0823ae4 0000081f c0573b44

Message from syslogd@raspberrypi at Jul 29 19:16:24 ...
 kernel:[  150.932037] fee0: 80841fc0 da5affb0 00001000 00003038 da5affac da5aff00 c0009204 c0146dfc

Message from syslogd@raspberrypi at Jul 29 19:16:24 ...
 kernel:[  150.944971] ff00: da5aff1c da5aff10 c0146dfc c0146d68 daa11000 00000000 beeeaeb8 00000128

Message from syslogd@raspberrypi at Jul 29 19:16:24 ...
 kernel:[  150.957905] ff20: c000f9e8 da5ae000 da5aff94 da5aff38 c047c7cc c047b8a0 00000000 00000001

Message from syslogd@raspberrypi at Jul 29 19:16:24 ...
 kernel:[  150.970831] ff40: 7f6428c4 00000000 fffffff7 da5afe90 0000000c 00000001 00000000 00000000

Message from syslogd@raspberrypi at Jul 29 19:16:24 ...
 kernel:[  150.983741] ff60: da5afe60 00000000 00000000 00000000 00000000 00000000 beeeaeb8 beeeaeb8

Message from syslogd@raspberrypi at Jul 29 19:16:24 ...
 kernel:[  150.996677] ff80: b6fddf10 00000000 da5affa4 da5aff98 c047c814 c047c78c 00000000 da5affa8

Message from syslogd@raspberrypi at Jul 29 19:16:24 ...
 kernel:[  151.009618] ffa0: c000f820 c047c808 beeeaeb8 b6fddf10 00000004 beeeaeb8 00000000 0000000c

Message from syslogd@raspberrypi at Jul 29 19:16:24 ...
 kernel:[  151.022541] ffc0: beeeaeb8 b6fddf10 00000000 00000128 8083cb34 0000011a 808330c0 80840fb8

Message from syslogd@raspberrypi at Jul 29 19:16:24 ...
 kernel:[  151.035446] ffe0: 00000000 beeeae94 7f61a388 b6f6d37c 60000010 00000004 00000000 00000000

Message from syslogd@raspberrypi at Jul 29 19:16:24 ...
 kernel:[  151.136256] Code: 1a000025 e59030b0 e3530000 0a00001b (e593400c)

Message from syslogd@raspberrypi at Jul 29 19:16:25 ...
 kernel:[  151.810011] Internal error: Oops: 1 [#2] ARM

Message from syslogd@raspberrypi at Jul 29 19:16:25 ...
 kernel:[  151.948402] Process systemd-udevd (pid: 748, stack limit = 0xd894a188)

Message from syslogd@raspberrypi at Jul 29 19:16:25 ...
 kernel:[  151.956749] Stack: (0xd894be78 to 0xd894c000)

Message from syslogd@raspberrypi at Jul 29 19:16:25 ...
 kernel:[  151.962924] be60:                                                       00000000 d69568d4

Message from syslogd@raspberrypi at Jul 29 19:16:25 ...
 kernel:[  151.974593] be80: c0876ce8 d6956800 d894beac d894be98 c04827e4 c0481bb0 00000000 fffffffe

Message from syslogd@raspberrypi at Jul 29 19:16:25 ...
 kernel:[  151.986212] bea0: d894bef4 d894beb0 c04c49f8 c04827c8 c0107dd0 d782d160 d88a2a80 00000000

Message from syslogd@raspberrypi at Jul 29 19:16:25 ...
 kernel:[  151.997855] bec0: 00000000 da619f20 da619f20 d782d160 00000000 d782d180 dad11010 d7871b28

Message from syslogd@raspberrypi at Jul 29 19:16:25 ...
 kernel:[  152.009585] bee0: d782d180 00000008 d894bf0c d894bef8 c047a6ec c04c47e4 d6966f00 00000000

Message from syslogd@raspberrypi at Jul 29 19:16:25 ...
 kernel:[  152.021489] bf00: d894bf1c d894bf10 c047a790 c047a6c8 d894bf5c d894bf20 c012dcdc c047a780

Message from syslogd@raspberrypi at Jul 29 19:16:25 ...
 kernel:[  152.033629] bf20: 00000000 00000000 c0109c64 d6966f08 d6966f00 d8869f48 d8869b40 c0889f90

Message from syslogd@raspberrypi at Jul 29 19:16:25 ...
 kernel:[  152.045938] bf40: 00000000 c000f9e8 d894a000 00000000 d894bf6c d894bf60 c012de88 c012dc50

Message from syslogd@raspberrypi at Jul 29 19:16:25 ...
 kernel:[  152.058412] bf60: d894bf8c d894bf70 c003b2b0 c012de7c 00000004 d894a000 c000f9e8 d894bfb0

Message from syslogd@raspberrypi at Jul 29 19:16:25 ...
 kernel:[  152.070976] bf80: d894bfac d894bf90 c0013524 c003b244 8083cb28 00000000 7f660004 00000006

Message from syslogd@raspberrypi at Jul 29 19:16:25 ...
 kernel:[  152.083616] bfa0: 00000000 d894bfb0 c000f848 c0013450 00000000 00000000 00000000 00000000

Message from syslogd@raspberrypi at Jul 29 19:16:25 ...
 kernel:[  152.096453] bfc0: 8083cb28 00000000 7f660004 00000006 beeeaaf8 7f66000c 8083cb28 80833008

Message from syslogd@raspberrypi at Jul 29 19:16:25 ...
 kernel:[  152.109361] bfe0: 00000000 beeea93c 7f62de58 b6f6cd3c 60000010 0000000c 00000000 00000000

Message from syslogd@raspberrypi at Jul 29 19:16:25 ...
 kernel:[  152.225862] Code: e5963008 e3a01000 e2433001 e5863008 (e894000c)

有人可以解释一下我做错了什么吗?谢谢。

1 个答案:

答案 0 :(得分:0)

问题在于Raspberry Pi的功率太低了。所以,Raspberry Pi或mjpg_streamer没有问题。