You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Containers/MJPEG-Streamer.md
+41-40Lines changed: 41 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,7 @@ If you have a Raspberry Pi Ribbon Camera, prepare your system like this:
35
35
``` console
36
36
$ grep "VERSION_CODENAME" /etc/os-release
37
37
```
38
-
38
+
39
39
The answer should be one of "buster", "bullseye" or "bookworm".
40
40
41
41
2. Configure camera support:
@@ -45,7 +45,7 @@ If you have a Raspberry Pi Ribbon Camera, prepare your system like this:
45
45
``` console
46
46
$ sudo raspi-config nonint do_camera 0
47
47
```
48
-
48
+
49
49
Buster pre-dates *LibCamera* so this is the same as enabling the *legacy* camera system. In this context, `0` means "enable" and `1' means "disable".
50
50
51
51
* if your system is running Bullseye or Bookworm, run these commands:
@@ -54,17 +54,17 @@ If you have a Raspberry Pi Ribbon Camera, prepare your system like this:
54
54
$ sudo raspi-config nonint do_camera 1
55
55
$ sudo raspi-config nonint do_legacy 0
56
56
```
57
-
57
+
58
58
The first command is protective and turns off the *LibCamera* subsystem, while the second command enables the *legacy* camera system.
59
-
59
+
60
60
> When executed from the command line, both the `do_camera` and `do_legacy` commands are supported in the Bookworm version of `raspi-config`. However, neither command is available when `raspi-config` is invoked as a GUI in a Bookworm system. This likely implies that the commands have been deprecated and will be removed, in which case this documentation will break.
61
61
62
62
3. Reboot your system:
63
63
64
64
``` console
65
65
$ sudo reboot
66
66
```
67
-
67
+
68
68
4. Make a note that your ribbon camera will be accessible on `/dev/video0`.
69
69
70
70
## Third-party cameras
@@ -77,20 +77,20 @@ The simplest approach is:
77
77
``` console
78
78
$ ls -l /dev/v4l/by-id
79
79
```
80
-
80
+
81
81
This is an example of the response with a LogiTech "C920 PRO FHD Webcam 1080P" camera connected:
4. If you know your camera supports higher resolutions, you can also set the size. Examples:
145
145
146
146
* the ribbon camera can support:
147
-
147
+
148
148
```
149
149
MJPG_STREAMER_SIZE=1152x648
150
150
```
151
-
151
+
152
152
* the Logitech C920 can support:
153
-
153
+
154
154
```
155
155
MJPG_STREAMER_SIZE=1920x1080
156
156
```
157
-
157
+
158
158
5. If the `mjpg-streamer` and `motioneye` containers are going to be running on:
159
159
160
160
* the **same** host, you can consider increasing the frame rate:
161
-
161
+
162
162
```
163
163
MJPG_STREAMER_FPS=30
164
164
```
165
-
165
+
166
166
Even though we are setting up a *web* camera, the traffic will never leave the host and will not traverse your Ethernet or WiFi networks.
167
-
167
+
168
168
* **different** hosts, you should probably leave the rate at 5 frames per second until you understand the impact on network traffic.
169
169
170
170
6. Save your work.
@@ -227,19 +227,19 @@ Error response from daemon: error gathering device information while adding cust
227
227
$ cd ~/IOTstack
228
228
$ docker-compose up -d mjpg-streamer
229
229
```
230
-
230
+
231
231
The first time you do this triggers a fairly long process. First, a basic operating system image is downloaded from DockerHub, then a Dockerfile is run to add the streamer software and construct a local image, after which the local image is instantiated as your running container. Subsequent launches use the local image so the container starts immediately. See also [container maintenance](#maintenance).
232
-
232
+
233
233
2. Once the container is running, make sure it is behaving normally and has not gone into a restart loop:
234
234
235
235
``` console
236
236
$ docker ps -a --format "table {{.Names}}\t{{.RunningFor}}\t{{.Status}}"
237
237
```
238
-
238
+
239
239
> The `docker ps` command produces a lot of output which generally results in line-wrapping and can be hard to read. The `--format` argument reduces this clutter by focusing on the interesting columns. If you have [IOTstackAliases](https://github.com/Paraphraser/IOTstackAliases) installed, you can use `DPS` instead of copy/pasting the above command.
240
-
240
+
241
241
If the container is restarting, you will see evidence of that in the STATUS column. If that happens, re-check the values set in the `.env` file and "up" the container again. The container's log (see below) may also be helpful.
242
-
242
+
243
243
3. Check the container's log:
244
244
245
245
``` console
@@ -255,11 +255,11 @@ Error response from daemon: error gathering device information while adding cust
255
255
o: username:password....: streamer:oNfDG-d1kgzC
256
256
o: commands.............: enabled
257
257
```
258
-
258
+
259
259
Many of the values you set earlier using environment variables show up here so viewing the log is a good way of making sure everything is being passed to the container.
260
-
260
+
261
261
Note:
262
-
262
+
263
263
* The `/dev/video0` in the first line of output is the **internal** device path (inside the container). This is **not** the same as the **external** device path associated with `MJPG_STREAMER_EXTERNAL_DEVICE`. The container doesn't know about the **external** device path so it has no way to display it.
264
264
265
265
## Connecting the camera to MotionEye
@@ -272,29 +272,29 @@ Error response from daemon: error gathering device information while adding cust
272
272
5. If the `motioneye` and `mjpg-streamer` containers are running on:
273
273
274
274
* the **same** host, the URL should be:
275
-
275
+
276
276
```
277
277
http://mjpg-streamer:80/?action=stream
278
278
```
279
-
279
+
280
280
Here:
281
-
281
+
282
282
- `mjpg-streamer` is the name of the **container**. Technically, it is a **host** name (rather than a domain name); and
283
283
- port 80 is the **internal** port that the streamer process running inside the container is listening to. It comes from the *right* hand side of the port mapping in the service definition:
284
-
284
+
285
285
``` yaml
286
286
ports:
287
287
- "8980:80"
288
-
```
289
-
288
+
```
289
+
290
290
* **different** hosts, the URL should be in this form:
291
-
291
+
292
292
```
293
293
http://«name-or-ip»:8980/?action=stream
294
294
```
295
-
295
+
296
296
Here:
297
-
297
+
298
298
- `«name-or-ip»` is the domain name or IP address of the host on which the `mjpg-streamer` container is running. Examples:
299
299
300
300
```
@@ -304,11 +304,12 @@ Error response from daemon: error gathering device information while adding cust
304
304
```
305
305
306
306
- port 8980 is the **external** port that the host where the `mjpg-streamer` container is running is listening on behalf of the container. It comes from the *left* hand side of the port mapping in the service definition:
307
-
307
+
308
308
``` yaml
309
309
ports:
310
310
- "8980:80"
311
-
```
311
+
```
312
+
312
313
6. Enter the Username ("streamer" in this example).
313
314
7. Enter the Password ("oNfDG-d1kgzC" in this example).
314
315
8. Click in the Username field again. This causes MotionEye to retry the connection, after which the camera should appear in the Camera field.
0 commit comments