Skip to content

Commit cfb5a8d

Browse files
committed
Use overrides to persist user configuration
- Use override file to persist user's camera configuration
1 parent 4e333a6 commit cfb5a8d

8 files changed

Lines changed: 95 additions & 74 deletions

File tree

docs/camera_support.md

Lines changed: 26 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The extended firmware includes hardware-accelerated camera support.
1010
- v4l2-mpp: MIPI CSI and USB camera support
1111
- WebRTC low-latency streaming
1212
- Hot-plug detection for USB cameras
13+
- Ability to select different stream types (WebRTC, MJPEG-adaptive, h264 iframe...)
1314

1415
## Accessing Cameras
1516

@@ -29,52 +30,39 @@ Access USB camera at:
2930
http://<printer-ip>/webcam2/
3031
```
3132

32-
You need to add USB camera in Fluidd. Use the following
33-
settings for the best performance:
33+
You need to add USB camera to Fluidd. Use the following settings for the best performance:
3434

3535
<img src="images/usb_cam.png" alt="Fluidd USB camera" width="300"/>
3636

37-
## Change Internal Camera Stream Type
37+
Alternatively, you can add USB camera to Moonraker configuration which also makes it available in Fluidd and all other Moonraker clients:
38+
39+
1. In web browser go to Fluidd Configuration editor at `http://<printer-ip>/#/configure`
40+
2. Enter `moonraker` directory and right-click on `03_usb_camera.cfg.disabled` and rename it to `03_usb_camera.cfg`
41+
5. Restart Moonraker service or printer for changes to take effect.
3842

39-
By default the internal camera stream uses WebRTC for low-latency streaming.
40-
Not all apps/integrations support WebRTC.
41-
To switch internal camera to MJPEG or h264 stream, simply rename existing preset files using either Fluidd or SSH interface:
43+
## Change Internal Camera Stream Type
4244

43-
<details>
44-
<summary>Click to expand Fluidd instructions</summary>
45+
By default the internal "case" camera streams in WebRTC format for low-latency and high-quality video.
46+
Some apps don't support WebRTC (Mobileraker, Homeassistant...), so you may want to switch the default stream type to MJPEG or h264 instead. Or you can have multiple stream types enabled at the same time and client apps can choose the one that works for them.
47+
To do that, simply rename the existing `09_user_camera.cfg.disabled` to `09_user_camera.cfg`. You can do that from Fluidd web interface:
4548

4649
1. In web browser go to Fluidd Configuration editor at `http://<printer-ip>/#/configure`
47-
2. Enter `moonraker` directory and right-click on the preset files to rename them
48-
- Disable WebRTC stream to prevent having multiple cameras in Fluidd:
49-
- Rename `02_webrtc_internal_camera.cfg` to `02_webrtc_internal_camera.cfg.disabled`
50-
- Enable mjpg-adaptive stream:
51-
- Rename `03_mjpg_internal_camera.cfg.disabled` to `03_mjpg_internal_camera.cfg`
52-
- Enable h264 stream:
53-
- Rename `04_h264_internal_camera.cfg.disabled` to `04_h264_internal_camera.cfg`
54-
55-
</details>
56-
57-
<details>
58-
<summary>Click to expand SSH instructions</summary>
59-
60-
```bash
61-
# Disable WebRTC stream to prevent having multiple cameras in Fluidd
62-
cd /home/lava/printer_data/config/moonraker/
63-
mv 02_webrtc_internal_camera.cfg 02_webrtc_internal_camera.cfg.disabled
64-
65-
# Enable mjpg-adaptive stream
66-
cd /home/lava/printer_data/config/moonraker/
67-
mv 03_mjpg_internal_camera.cfg.disabled 03_mjpg_internal_camera.cfg
68-
69-
# Enable h264 stream
70-
cd /home/lava/printer_data/config/moonraker/
71-
mv 04_h264_internal_camera.cfg.disabled 04_h264_internal_camera.cfg
72-
73-
# Restart moonraker to apply changes
74-
/etc/init.d/S61moonraker restart
75-
```
50+
2. Enter `moonraker` directory, right-click on `09_user_camera.cfg.disabled` and rename it to `09_user_camera.cfg`
51+
That file contains a section which disables default WebRTC stream:
52+
53+
```ini
54+
[webcam case]
55+
enabled: false
56+
```
57+
58+
If you prefer to keep the WebRTC stream enabled, simply toggle it to `enabled: true` and modify its settings as needed.
59+
60+
3. Edit any other webcam sections to enable other stream types and configure their settings.
61+
Refer to [09_user_camera.cfg.disabled](../overlays/camera-v4l2-mpp/root/home/lava/origin_printer_data/config/moonraker/09_user_camera.cfg.disabled) content for examples.
62+
4. Save the changes
63+
5. Restart Moonraker service or printer for changes to take effect.
7664

77-
</details>
65+
Refer to official [Moonraker documentation](https://moonraker.readthedocs.io/en/latest/configuration/#webcam) for more details on available webcam settings.
7866

7967
## Switch to Snapmaker's Original Camera Stack
8068

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# DO NOT EDIT OR DELETE THIS FILE
2+
# Firmware update will overwrite this file!
3+
# Instead, rename 09_user_camera.cfg.disabled to 09_user_camera.cfg and edit that file.
4+
# In that file you can disable this default camera by setting:
5+
# [webcam case]
6+
# enabled: false
7+
# Follow instructions in 09_user_camera.cfg.disabled to customize this camera; do not edit it here.
8+
9+
# Default internal camera using WebRTC, do not edit here.
10+
[webcam case]
11+
enabled: true
12+
service: webrtc-camerastreamer
13+
stream_url: /webcam/webrtc
14+
snapshot_url: /webcam/snapshot.jpg
15+
aspect_ratio: 16:9
16+
target_fps: 15
17+
target_fps_idle: 1

overlays/camera-v4l2-mpp/root/home/lava/origin_printer_data/config/moonraker/02_webrtc_internal_camera.cfg

Lines changed: 0 additions & 9 deletions
This file was deleted.

overlays/camera-v4l2-mpp/root/home/lava/origin_printer_data/config/moonraker/03_mjpg_internal_camera.cfg.disabled

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To add USB camera to Moonraker and all of its clients (Fluidd), simply rename this file to 03_usb_camera.cfg
2+
3+
# USB camera using WebRTC
4+
[webcam usb]
5+
enabled: true
6+
service: webrtc-camerastreamer
7+
stream_url: /webcam2/webrtc
8+
snapshot_url: /webcam2/snapshot.jpg
9+
aspect_ratio: 16:9
10+
target_fps: 15
11+
target_fps_idle: 1

overlays/camera-v4l2-mpp/root/home/lava/origin_printer_data/config/moonraker/04_h264_internal_camera.cfg.disabled

Lines changed: 0 additions & 9 deletions
This file was deleted.

overlays/camera-v4l2-mpp/root/home/lava/origin_printer_data/config/moonraker/09_usb_camera.cfg.disabled

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# To customize camera streams:
2+
# 1. Rename this file to 09_user_camera.cfg using Fluidd web interface or SSH shell.
3+
# 2. Enable stream types that you want by changing "enabled" to true.
4+
# Enabling multiple stream types will add multiple cameras to Fluidd and other clients.
5+
# 3. Feel free to adjust other parameters as needed.
6+
7+
8+
# Default Internal camera using WebRTC
9+
# This webcam must be named "case" to override default settings from 02_default_internal_camera.cfg
10+
# Enabling this camera and modifying its settings here will override default settings from 02_default_internal_camera.cfg
11+
[webcam case]
12+
enabled: false
13+
service: webrtc-camerastreamer
14+
stream_url: /webcam/webrtc
15+
snapshot_url: /webcam/snapshot.jpg
16+
aspect_ratio: 16:9
17+
target_fps: 15
18+
target_fps_idle: 1
19+
20+
# Internal camera using MJPEG-adaptive, enable by setting "enabled: true"
21+
[webcam mjpeg]
22+
enabled: false
23+
service: mjpegstreamer-adaptive
24+
stream_url: /webcam/stream.mjpg
25+
snapshot_url: /webcam/snapshot.jpg
26+
aspect_ratio: 16:9
27+
target_fps: 15
28+
target_fps_idle: 1
29+
30+
# Internal camera using h264 embedded player, enable by setting "enabled: true"
31+
[webcam h264]
32+
enabled: false
33+
service: iframe
34+
stream_url: /webcam/player
35+
snapshot_url: /webcam/snapshot.jpg
36+
aspect_ratio: 16:9
37+
target_fps: 15
38+
target_fps_idle: 1
39+
40+
# More stream types and parameters can be added using syntax from official Moonraker documentation.
41+
# https://moonraker.readthedocs.io/en/latest/configuration/#webcam

0 commit comments

Comments
 (0)