aktuell lauffähige Version auf Terminal 1

This commit is contained in:
livecam 2020-08-14 13:13:12 +02:00
parent df8d12d0f2
commit be56a2a2fb
2 changed files with 63 additions and 15 deletions

View File

@ -1,13 +0,0 @@
#!/bin/bash #terminal1 sleep 20
#Audio von cam1
gst-launch-1.0 -v udpsrc port=5003 caps="application/x-rtp" ! rtpjitterbuffer latency=20 do-lost=True ! rtpopusdepay ! opusdec plc=true ! alsasink device=hw:1 &
#Audio zu cam1
gst-launch-1.0 -vv alsasrc device=plughw:1,0 ! audioconvert ! audioresample ! opusenc ! rtpopuspay ! udpsink host=cam1 port=5002 &
#start video output
while true; do
omxplayer --fps 60 --live --threshold 0.1 tcp://@cam1:5001 -s -r
sleep 1
done

View File

@ -25,8 +25,7 @@ export DISPLAY=:0
while true; do
# rename window (FIXME: possible race condition with window for cam 2)
GSTXID="$(wmctrl -l | grep "OpenGL renderer" | cut -d" " -f1)" >/dev/null 2>&1
wmctrl -i -r "$GSTXID" -e 0,0,0,1000,1000 >/dev/null 2>&1
# wmctrl -i -r "$GSTXID" -e 0,1500,0,1000,1000 >/dev/null 2>&1
wmctrl -i -r "$GSTXID" -e 0,2000,0,1000,1000 >/dev/null 2>&1
wmctrl -i -r "$GSTXID" -b add,fullscreen >/dev/null 2>&1
wmctrl -i -r "$GSTXID" -b add,above >/dev/null 2>&1
wmctrl -i -r "$GSTXID" -N gst-cam1 >/dev/null 2>&1 && break
@ -40,6 +39,68 @@ export DISPLAY=:0
) &
PIDS="$PIDS $!"
# receive audio stream from cam1
amixer -c0 sset 'Master' 100%
amixer -c0 sset 'PCM' 0%
(
while true; do
gst-launch-1.0 -v udpsrc address=:: port=5008 caps="application/x-rtp" ! rtpjitterbuffer latency=20 do-lost=True ! rtpopusdepay ! opusdec plc=true ! alsasink device=hw:0
done
) &
PIDS="$PIDS $!"
# send audio stream to cam1
amixer -c0 sset 'Mic' 100%
(
while true; do
gst-launch-1.0 -vv alsasrc device=plughw:0 ! audioconvert ! audioresample ! opusenc ! rtpopuspay ! udpsink host=cam1 port=5007
done
) &
PIDS="$PIDS $!"
# receive video stream from cam2
(
while true; do
gst-launch-1.0 -e rtpbin name=b rtp-profile=avpf do-retransmission=true \
udpsrc address=:: port=5004 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" ! b.recv_rtp_sink_0 b. ! rtpulpfecdec ! rtph264depay ! decodebin ! videoconvert ! videoscale ! video/x-raw,width=1024,height=786 ! xvimagesink \
udpsrc address=:: port=5006 ! b.recv_rtcp_sink_0 \
b.send_rtcp_src_0 ! udpsink host=cam2 port=5005 sync=false async=false &
GSTPID=$!
while true; do
# rename window (FIXME: possible race condition with window for cam 2)
GSTXID="$(wmctrl -l | grep "gst-launch-1.0" | cut -d" " -f1)" >/dev/null 2>&1
wmctrl -i -r "$GSTXID" -e 0,0,0,1000,1000 >/dev/null 2>&1
wmctrl -i -r "$GSTXID" -b add,fullscreen >/dev/null 2>&1
wmctrl -i -r "$GSTXID" -b add,above >/dev/null 2>&1
wmctrl -i -r "$GSTXID" -N gst-cam2 >/dev/null 2>&1 && break
kill -s 0 $GSTPID || break
sleep .2
done
wait $GSTPID
sleep .2
done
) &
PIDS="$PIDS $!"
# receive audio stream from cam2
amixer -c1 sset 'Speaker' 100%
(
while true; do
gst-launch-1.0 -v udpsrc address=:: port=5010 caps="application/x-rtp" ! rtpjitterbuffer latency=20 do-lost=True ! rtpopusdepay ! opusdec plc=true ! alsasink device=hw:1
done
) &
PIDS="$PIDS $!"
# send audio stream to cam2
amixer -c1 sset 'Master' 100%
(
while true; do
gst-launch-1.0 -vv alsasrc device=plughw:1 ! audioconvert ! audioresample ! opusenc ! rtpopuspay ! udpsink host=cam1 port=5009
done
) &
PIDS="$PIDS $!"
wait $PIDS