Skip to main content

webcam mit mjpg-streamer

Hardware

Vbestlife 12 MP USB-Kameramodul, 4K HD 123 Grad Ansichten IMX258 (1/3,06 Zoll)

https://www.amazon.de/dp/B0BDLSZ2N2?psc=1&ref=ppx_yo2ov_dt_b_product_details

deb packages

sudo apt install v4l-conf v4l-utils

mjpg streamer:

https://github.com/john-clark/mjpg-streamer-setup

start.sh

#!/bin/sh
export LD_LIBRARY_PATH="$(pwd)"
./mjpg_streamer -i "input_uvc.so -n -f 30 -r 1280x720 -d /dev/video1"  -o "output_http.so" &


### check the service configuration
klipper@voron:~/mjpg-streamer ‹master*›$ sudo vi  /etc/systemd/system/webcamd.service
[Unit]
Description=Starts mjpg-streamer on startup
After=network.target

[Install]
WantedBy=multi-user.target

[Service]
Type=forking
User=klipper
WorkingDirectory=/home/klipper/mjpg-streamer
StandardOutput=append:/var/log/webcamd.log
StandardError=append:/var/log/webcamd.log
ExecStart=/home/klipper/mjpg-streamer/start.sh
Restart=always

### Reload the service configuration
klipper@voron:~/mjpg-streamer ‹master*›$ sudo systemctl daemon-reload

### enable autostart
klipper@voron:~/mjpg-streamer ‹master*›$ sudo systemctl enable webcamd.service

### restart or start the service
klipper@voron:~/mjpg-streamer ‹master*›$ sudo systemctl restart webcamd.service

### check the state and feel happy
klipper@voron:~/mjpg-streamer ‹master*›$ sudo systemctl status webcamd.service
● webcamd.service - Starts mjpg-streamer on startup
     Loaded: loaded (/etc/systemd/system/webcamd.service; disabled; vendor preset: enabled)
     Active: active (running) since Wed 2023-05-10 14:17:15 CEST; 7s ago
    Process: 15063 ExecStart=/home/klipper/mjpg-streamer/start.sh (code=exited, status=0/SUCCESS)
   Main PID: 15065 (mjpg_streamer)
      Tasks: 3 (limit: 2212)
     Memory: 916.0K
        CPU: 77ms
     CGroup: /system.slice/webcamd.service
             └─15065 ./mjpg_streamer -i input_uvc.so -n -f 30 -r 1280x720 -d /dev/video1 -o output_http.so

Mai 10 14:17:15 voron mjpg_streamer[15065]: MJPG-streamer [15065]: Frames Per Second.: 30
Mai 10 14:17:15 voron mjpg_streamer[15065]: MJPG-streamer [15065]: Format............: JPEG
Mai 10 14:17:15 voron mjpg_streamer[15065]: MJPG-streamer [15065]: TV-Norm...........: DEFAULT
Mai 10 14:17:15 voron mjpg_streamer[15065]: MJPG-streamer [15065]: www-folder-path......: disabled
Mai 10 14:17:15 voron mjpg_streamer[15065]: MJPG-streamer [15065]: HTTP TCP port........: 8080
Mai 10 14:17:15 voron mjpg_streamer[15065]: MJPG-streamer [15065]: HTTP Listen Address..: (null)
Mai 10 14:17:15 voron mjpg_streamer[15065]: MJPG-streamer [15065]: username:password....: disabled
Mai 10 14:17:15 voron mjpg_streamer[15065]: MJPG-streamer [15065]: commands.............: enabled
Mai 10 14:17:15 voron mjpg_streamer[15065]: MJPG-streamer [15065]: starting input plugin input_uvc.so
Mai 10 14:17:15 voron mjpg_streamer[15065]: MJPG-streamer [15065]: starting output plugin: output_http.so (ID: 00)