Skip to main content

Multi-Camera Configuration

GoCam in FLYOS-FAST v1.4.0 supports connecting multiple UVC cameras to the same host. This article uses two cameras as an example to explain the complete configuration method; three or four cameras work the same way.

Applicable Versions

Multi-camera support depends on GoCam and is only available in FLYOS-FAST v1.4.0 and later. For machines using Crowsnest, please refer to Camera Connection and Usage. For basic usage of a single GoCam, please refer to GoCam Camera Service.

Ports and Access Addresses​

The port of each camera corresponds one-to-one with the web path. The /webcamN/ prefix is preconfigured by nginx at the factory and does not need to be modified. Click the icon to the right of the address to copy it:

Camera and PortLive Video StreamSingle-Frame Snapshot
Camera 1 · 8080
Loading...
Loading...
Camera 2 · 8081
Loading...
Loading...
Camera 3 · 8082
Loading...
Loading...
Camera 4 · 8083
Loading...
Loading...

The pattern is: the port of camera N is 8080 + (N - 1), and the web path is /webcamN/, where camera 1 omits the number and is written as /webcam/.

?action=stream and ?action=snapshot are GoCam's mjpg-streamer-compatible syntax, equivalent to /stream and /snapshot respectively. This is built-in interface behavior, not an option that needs to be configured.

Connecting Cameras​

For camera selection, wiring methods, and driver-free UVC requirements, please refer to Camera Connection and Usage.

In multi-camera scenarios, each camera should be connected to a different USB port on the host, and should not go through the same unpowered hub. Before plugging or unplugging cameras, completely shut down the printer and disconnect power.

Step 1: Open the Configuration​

For how to open the configuration file and view device nodes (camera IDs) in Fluidd, please refer to Open Configuration.

In multi-camera scenarios, each camera must be assigned its capture node (video-index0), not the metadata node, and should be pinned by USB physical port to avoid the node number changing after a reboot and causing failure.

Step 2: Write the Multi-Camera Configuration​

The configuration file is located at:

/usr/share/printer_data/config/gocam.conf

Two-camera configuration example (device pinned using by-path, resolution set according to actual measurements):

[cam 1]
port: 8080
device: /dev/v4l/by-path/platform-5311000.usb-usb-0:1:1.0-video-index0
resolution: 640x480
max_fps: 15
quality: 5

[cam 2]
port: 8081
device: /dev/v4l/by-path/platform-5101000.usb-usb-0:1:1.0-video-index0
resolution: 640x480
max_fps: 15
quality: 5
ParameterDescription
portThe HTTP port that this camera listens on; must not be duplicated between cameras
deviceThe path of this camera's capture node (video-index0)
resolutionThe resolution actually supported by the camera, in the format widthxheight
max_fpsMaximum frame rate; recommended not to exceed the camera's enumerated value
qualityMJPEG quality, ranging from 1 to 31; the smaller the value, the better the image quality and the higher the bandwidth
v4l2ctlOptional, UVC parameters; parameters saved on the management page are written to this item
ffmpeg_flagsOptional, FFmpeg parameters
Software Encoding vs. Passthrough

Cameras that only support the YUYV format need to be software-encoded to MJPEG by the host, which uses more CPU. Cameras that support MJPG can pass through with almost no CPU usage. If both cameras can only use YUYV, it is recommended to start with 640x480 at 15 fps; if one camera supports MJPG, you can increase the resolution for that one separately.

Step 3: Add Camera Panels in the Web Interface​

After configuring GoCam, you also need to register the cameras in Moonraker before Fluidd / Mainsail will display the panels.

In Fluidd, open Settings → Cameras and confirm that the two entries are filled in as follows:

EntryStream URLSnapshot URL
Camera 1
Loading...
Loading...
Camera 2
Loading...
Loading...
Common Mistakes
  • The second camera is still written as /webcam/: both panels will display the same camera's image. Camera N must use /webcamN/.
  • Entries added in the web interface are stored in the Moonraker database (source is database); changing only moonraker.conf will not take effect, and you must modify them in the interface.
  • Moonraker's /server/webcams/item interface only supports query, add, and delete, and does not support modification; please operate in the interface as well.

If you need to add entries via the configuration file (without modifying existing entries in the database), you can append the following to moonraker.conf:

[webcam cam2]
enabled: true
service: mjpegstreamer-adaptive
target_fps: 15
stream_url: /webcam2/?action=stream
snapshot_url: /webcam2/?action=snapshot

FAQ​

SymptomPossible CauseSolution
Page shows NO SIGNAL, frames stays at 0device points to the metadata node, or resolution exceeds the camera's capabilityCheck with --list-formats-ext and switch to video-index0
Both panels show exactly the same imageThe second camera's URL is still written as /webcam/Change to /webcam2/?action=stream
One camera stops working after a reboot/dev/videoN numbers change with plug/unplug orderChange device to /dev/v4l/by-path/...-video-index0
The second camera's port is unreachable[cam 2] is not configured, or the port conflicts with another serviceUse ss -lntp | grep 8081 to confirm it is listening
Stuttering image and increased host loadYUYV software encoding combined with high resolution and high frame rateLower the resolution or frame rate, or switch to a camera that supports MJPG
Loading...