Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Addition] Videoserver #4

Open
emphasize opened this issue Apr 24, 2022 · 0 comments
Open

[Addition] Videoserver #4

emphasize opened this issue Apr 24, 2022 · 0 comments

Comments

@emphasize
Copy link
Owner

Mit der Implementierung von 5707719 ist die Möglichkeit hinzugekommen, einen Videoserver als feed für das sipphone (pjsua) zu nutzen.

Da die benötigten Sytemressourcen noch nicht im Installationsscript verankert sind, hier die Dependenzen

#--- v4l2loopback
sudo apt install v4l2loopback-dkms v4l2loopback-utils

#Falls Probleme auftreten, video0 und video1 vertauscht werden (und damit der rtsp server nicht funktioniert)
#kann man statt devices=1 video_nr=X festlegen
#ACHTUNG: der wert von video_nr MUSS 3 oder kleiner sein, da sonst PJSUA das Gerät nicht initialisiert
#Es als /dev/video0 zu laden hat den vorteil, das es damit zum default device in PJSUA wird

echo "v4l2loopback" | sudo tee -a /etc/modules

echo 'options v4l2loopback devices=1
options v4l2loopback max_buffers=2
options v4l2loopback exclusive_caps=1
options v4l2loopback card_label="VirtualDoorpiCam #0"' | sudo tee /etc/modprobe.d/v4l2loopback.conf

Wer einen server aufsetzen will:

#--- v4l2rtspserver
sudo apt -y install cmake liblog4cpp5-dev libv4l-dev git

## Edit as needed. 
VID_WIDTH=720
VID_HEIGHT=480
VID_FRAMES=15
VID_SER_PORT=7447
VID_DEV=/dev/video1
cd ~
git clone https://github.com/mpromonet/v4l2rtspserver.git
cd v4l2rtspserver/
cmake . && make && sudo make install

sudo sed -i "s#^ExecStart=.*#ExecStart=\/usr\/local\/bin\/v4l2rtspserver -W $VID_WIDTH -H $VID_HEIGHT -F $VID_FRAMES -P $VID_SER_PORT $VID_DEV#g" /lib/systemd/system/v4l2rtspserver.service

sudo systemctl enable v4l2rtspserver
cd ~ && rm -rf v4l2rtspserver

Reboot + Test (z.B. VLC Client): rtsp://<localip>:7447/unicast

Zur Erklärung: Der RTSP Server streamt direkt von dem Kamera Modul. Doorpi (resp. FFmpeg) transcoded den feed und legt ihn auf das loopback device (das wiederum von pjsua gelesen wird). Ähnlich funktioniert es, wenn man einen nicht stationären stream einbinden will (stream->tanscoding->loopback->pjsua)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant