Vermeiden des libcamerify-Wrappers
Vermeiden des libcamerify-Wrappers
Grundproblem
Früher wurden Kameras über V4L (Video4Linux) bereitgestellt - auch die PiCams. Das wurde vor einiger Zeit geändert - während klassische USB-Webcams weiter als /dev/video0 etc. erreichbar sind, trifft dies nun nicht mehr für PiCams zu. Es gibt einen Wrapper, "libcamerify", der anderen Programmen ein /dev/video[n]-Gerät vorgaukeln kann, aber so wirklich brauchbar ist der nicht, und auch nur als Übergangslösung gedacht.
Lösungsansatz 1
Analog der Lösung in Abgesetzte_Bildausgabe-Einheit_(ABE) soll wieder gstreamer zum Einsatz kommen, nur dieses Mal lokal auf ein und dem selben Pi.
Lösungsansatz 2
Pipewire verwenden - das klappt aber vermutlich nur für Linphone und nicht für baresip.
Achtung, die folgenden Lösungen stammen aus den Antworten eines LLM, und sind ungetestet
Grundsätzliche Einrichtung für Lösungsansatz 1
sudo apt update && sudo apt install gstreamer1.0-plugins-bad gstreamer1.0-tools gstreamer1.0-libcamera
~/.baresip/config
module gst_video.so video_source gst_video,libcamerasrc ! videoconvert ! video/x-raw,width=1280,height=720,framerate=30/1
~/.linphonerc
[video] capture_plugin=msgstcapture camera=GStreamer: libcamerasrc
Fehlt hier noch was, um gstreamer zu starten?
-> Nochmal das LLM fragen
Grundsätzliche Einrichtung für Lösungsansatz 2
sudo apt update sudo apt install pipewire wireplumber libspa-0.2-libcamera pipewire-audio
Startskript für Systemd
/etc/systemd/system/linphone-daemon.service
[Unit] Description=Linphone Headless VoIP Daemon After=network-online.target wireplumber.service Wants=network-online.target wireplumber.service [Service] Type=simple # Runs under the standard pi user or any user belonging to audio/video groups User=pi Environment=XDG_RUNTIME_DIR=/run/user/1000 ExecStart=/usr/bin/linphone-daemon --pipe Restart=always RestartSec=5 [Install] WantedBy=multi-user.target
Zum Installieren
sudo systemctl daemon-reload && sudo systemctl enable --now linphone-daemon.service grep -q '^pipewire &' ~/.config/openbox/autostart || echo 'pipewire &' >>~/.config/openbox/autostart grep -q '^wireplumber &' ~/.config/openbox/autostart || echo 'wireplumber &' >>~/.config/openbox/autostart
Startskript für SysVinit
/etc/init.d/linphone-daemon
#!/bin/sh
### BEGIN INIT INFO
# Provides: linphone-daemon
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Linphone Headless VoIP Daemon
### END INIT INFO
PIDFILE=/var/run/linphone-daemon.pid
DAEMON=/usr/bin/linphone-daemon
DAEMON_ARGS="--pipe"
USER=pi
case "$1" in
start)
echo "Starting Linphone Daemon..."
export XDG_RUNTIME_DIR=/run/user/1000
start-stop-daemon --start --background --chuid "$USER" --make-pidfile --pidfile "$PIDFILE" --exec "$DAEMON" -- $DAEMON_ARGS
;;
stop)
echo "Stopping Linphone Daemon..."
start-stop-daemon --stop --pidfile "$PIDFILE" --retry 5
rm -f "$PIDFILE"
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
exit 0
Zum Installieren
sudo chmod +x /etc/init.d/linphone-daemon && sudo update-rc.d linphone-daemon defaults grep -q '^pipewire &' ~/.config/openbox/autostart || echo 'pipewire &' >>~/.config/openbox/autostart grep -q '^wireplumber &' ~/.config/openbox/autostart || echo 'wireplumber &' >>~/.config/openbox/autostart
Test
pw-cli dump Node
-> Da sollte sowas wie rpi.vc.camera, IMX219, or IMX708 auftauchen
Baresip lässt sich dabei sowohl per X11 wie auch per Framebuffer nutzen
~/.baresip/config für X11
video_source gst_video,libcamerasrc ! videoconvert ! video/x-raw,width=1280,height=720,framerate=30/1 video_display x11,nil
~/.baresip/config für Framebuffer
# Capture the PiCam natively video_source gst_video,libcamerasrc ! videoconvert ! video/x-raw,width=1280,height=720,framerate=30/1 # Render incoming video straight to the HDMI framebuffer without an X server video_display gst_video,appsink name=video_sink ! videoconvert ! kmssink