Update service

This commit is contained in:
Kamil Trzcinski 2022-07-07 12:18:02 +02:00
parent 6b9d957641
commit 2be35c8793
4 changed files with 85 additions and 8 deletions

View File

@ -53,6 +53,22 @@ sudo make install
There are three modes of operation implemented offering different
compatibility to performance.
### Use a preconfigured systemd services
The simplest is to use preconfigured `service/camera-streamer*.service`.
Those can be used as an example, and can be configured to fine tune parameters.
Example:
```bash
systemctl enable $PWD/service/camera-streamer-arducam-16MP.service
systemctl start camera-streamer-arducam-16MP
```
If everything was OK, there will be web-server at `http://<IP>:8080/`.
Error messages can be read `journalctl -xef -u camera-streamer-arducam-16MP`.
### High-compatibility via `libcamera`
This script uses `libcamera` to access camera and provide

View File

@ -3,21 +3,22 @@ Description=camera-streamer web camera
After=network.target
[Service]
User=nobody
Group=nogroup
SupplementaryGroups=video i2c
ExecStart=/usr/local/bin/camera-streamer \
-camera-path=/base/soc/i2c0mux/i2c@1/imx519@1a \
-camera-type=libcamera \
-camera-format=YUYV \
-camera-width=2328 -camera-height=1748 \
-camera-high_res_factor=1.5 \
-camera-fps=30
# set auto-focus for IMX519
ExecStartPost=-/bin/bash -c 'sleep 3s; /usr/sbin/i2ctransfer -y 11 w4@0x0c 0x0 0x85 0x00 0x00'
-camera-fps=30 \
-camera-nbufs=2 \ # use two memory buffers to optimise usage
-camera-high_res_factor=1.5 \ # the high-res is 1552x1165
-camera-low_res_factor=3.0 \ # the low-res is 776x582
-camera-options=brightness=0.1 # bump brightness slightly
User=nobody
Group=nogroup
SupplementaryGroups=video i2c
Restart=always
RestartSec=10
Nice=10
IOSchedulingClass=idle
IOSchedulingPriority=7

View File

@ -0,0 +1,32 @@
[Unit]
Description=camera-streamer web camera
After=network.target
[Service]
ExecStartPre=-/usr/bin/v4l2-ctl -d /dev/v4l-subdev1 -c focus_absolute=2200 # set fixed-focus
ExecStart=/usr/local/bin/camera-streamer \
-camera-path=/base/soc/i2c0mux/i2c@1/arducam_64mp@1a \
-camera-type=libcamera \
-camera-format=YUYV \
-camera-width=2328 -camera-height=1748 \
-camera-fps=30 \
-camera-nbufs=2 \ # use two memory buffers to optimise usage
-camera-high_res_factor=1.5 \ # the high-res is 1552x1165
-camera-low_res_factor=3.0 \ # the low-res is 776x582
-camera-options=brightness=0.1 \ # bump brightness slightly
-camera-auto-focus=0 # disable auto-focus
User=nobody
Group=nogroup
SupplementaryGroups=video i2c
Restart=always
RestartSec=10
Nice=10
IOSchedulingClass=idle
IOSchedulingPriority=7
CPUWeight=20
AllowedCPUs=1-2
MemoryMax=250M
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,28 @@
[Unit]
Description=camera-streamer web camera
After=network.target
[Service]
ExecStart=/usr/local/bin/camera-streamer \
-camera-path=/dev/video0 \
-camera-format=JPEG \
-camera-width=1920 -camera-height=1080 \
-camera-fps=30 \
-camera-nbufs=2 \ # use two memory buffers to optimise usage
-camera-high_res_factor=1.0 \ # the high-res is 1920x1080
-camera-low_res_factor=2.0 # the low-res is 960x540
User=nobody
Group=nogroup
SupplementaryGroups=video i2c
Restart=always
RestartSec=10
Nice=10
IOSchedulingClass=idle
IOSchedulingPriority=7
CPUWeight=20
AllowedCPUs=1-2
MemoryMax=250M
[Install]
WantedBy=multi-user.target