[cam] section

You have to create a [cam] section per camera and name your cameras by placing the name inside the square brackets.

[cam raspi]
mode: camera-streamer
...

[cam logiC270]
mode: ustreamer
...

mode

The streaming mode used by Crowsnest. Default: mode: ustreamer Available options:

ustreamer

This mode uses the mjpg protocol and streams with ustreamer. It's basically a series of jpeg images. This mode uses a lot of bandwidth depending on the resolution and frame rate set.

camera-streamer

This mode uses camera-streamer as backend.

camera-streamer is only available on Raspberry Pi's currently, more SBC's will follow. The greatest advantage of camera-streamer is, it uses the inbuilt GPU of the Pi SBC to deliver hardware encoded h.264 as format. This allows you to stream your video feed in webrtc, which has the advantage of using less bandwith without loosing quality and/or framerates/resolution. It also provides simultaniously stream of rtsp (if enabled through `enable_rtsp: true`), mjpg and snapshots.

enable_rtsp

If `mode: camera-streamer` is used, this will enable the RTSP Server of camera-streamer.

The stream's URL becomes rtsp://<printer-ip-or-name>:<rtsp_port>/stream.h264 Example: rtsp://mainsailos.local:8554/stream.h264

rtsp_port

This setting allows you to set a port for the rtsp server. Only available with `mode: camera-streamer`

port

The network port through which the camera is accessible. This setting only affects the mjpg mode (ustreamer). Default: port: 8080

Note: In MainsailOS, by default four webcam ports are mapped to URLs. Notice that the first URL doesn't contain a number. You can simply add these to the Mainsail settings.

Port
Stream URL
Snapshot URL

8080

/webcam/?action=stream

/webcam/?action=snapshot

8081

/webcam2/?action=stream

/webcam2/?action=snapshot

8082

/webcam3/?action=stream

/webcam3/?action=snapshot

8083

/webcam4/?action=stream

/webcam4/?action=snapshot

A small note on WebRTC

In order to use WebRTC, please replace ?action=stream with webrtc. Keep in mind this will only work if you use mode: camera-streamer.

Webcam settings for WebRTC (camera-streamer)

device

The path of the video device (camera) to be used by the configured streaming service. All available devices are listed in the log file every time Crowsnest is started. You can copy the path from there. Default: device: /dev/video0

A path in this format is also valid:

Always prefer full paths as shown above, especcially in Mutlicam setups using /dev/video* will lead to errors or unexpected behaviours.

resolution

The desired streaming resolution, formatted as heightxwidth without spaces. Default: resolution: 640x480

Note: This is case sensitive! Do not use capital 'X' !

The resolution has a big impact on the bandwidth, especially in mjpg mode.

There are two practical ways to determine, which resolutions are supported by your device:

  • from crowsnest.log

Example log file
  • using dev-helper.sh from tools directory

Sample output

max_fps

The desired streaming FPS (frames per second). Default max_fps: 15

Note:

  • It is necessary to research which FPS in combination with which resolution your camera supports. For detailed information run v4l2-ctl --list-formats-ext in your SSH session.

  • The FPS has a big impact on the bandwidth, especially in mjpg mode.

  • This setting is mostly ignored in rtsp mode.

custom_flags

This setting allows you to pass advanced parameters to ustreamer. It is possible to adjust image parameters such as brightness, contrast and saturation, or to flip the image. The passed parameters are appended to the already configured parameters. However, your camera needs to support these advanced parameters as well. Default: custom_flags:

Note: The flags are separated by a single space, not by a comma.

You need to take a closer look at the documentation of the ustreamer project. As a guide, we have placed ustreamer's manpage in crowsnest repository.

Please prefer ustreamer's project page. Our manpage may not accurate

v4l2ctl

This option allows to pass parameters for the configured device to V4L2 "the driver". Depending on the camera model, it is possible to pass different parameters, but not all parameters are supported by every camera. Commented out by default.

Note: It is a very tough topic and is only recommended for advanced users.

Example: v4l2ctl: paramter1=value1,parameter2=value2,parameter3=....

There are also two ways to determine what your device is capable of

  • via crowsnest.log

Example log output:
  • or as earlier mentioned using dev-helper.sh script

Example of an application

A Logitech C920 camera has autofocus activated by default. To get a nice picture, the manual focus should be activated. Until now, one had to use a cronjob that executes a script with v4l2-ctl commands. This was very inconvenient and a lot of set-up.

In Crowsnest you can simply specify these options in the config:

Restart Crowsnest service via Mainsail and you're good to go.

Take a look at alexz' crowsnest.conf file.

Last updated

Was this helpful?