Gstreamer Stream Video

Make sure a module-null-sink with the name “mic.monitor” is available.

You may want to create such a device at startup.

Pulse

vi ~/.config/pulse/default.pa
.include /etc/pulse/default.pa
load-module module-null-sink sink_name=recording sink_properties=device.description=recording

Sender

It is done with the RTP protocol to ensure lost packages are sent again.

#!/bin/bash
echo 'gstSender.sh'

gstproc=""

gst_exit () {
	kill $gstproc
}

gst-launch-1.0 rtpbin name=rb rtp-profile=avpf ximagesrc show-pointer=false ! video/x-raw,framerate=30/1 ! videoconvert ! x265enc bitrate=400 speed-preset=1 ! rtph265pay mtu=1372 ! rtprtxqueue ! rb.send_rtp_sink_0 rb.send_rtp_src_0 ! udpsink host=192.168.0.10 port=5109 sync=false rb.send_rtcp_src_0 ! udpsink host=192.168.0.10 port=5110 sync=false async=false udpsrc port=5110 ! rb.recv_rtcp_sink_0 pulsesrc device="recording.monitor" ! 'audio/x-raw, format=(string)S16LE, layout=(string)interleaved, rate=(int)48000, channels=(int)2' ! audioconvert ! opusenc frame-size=60 ! rtpopuspay pt=96 ! rtprtxqueue ! rb.send_rtp_sink_1 rb.send_rtp_src_1 ! udpsink host=192.168.0.10 port=5106 sync=false rb.send_rtcp_src_1 ! udpsink host=192.168.0.10 port=5111 sync=false async=false udpsrc port=5111 ! rb.recv_rtcp_sink_1 &
gstproc=$!

trap gst_exit INT
trap gst_exit HUP

wait $gstproc
exit 0

Receiver

#!/bin/bash
echo "gstReceiver.sh"

gstproc=""

gst_exit () {
    kill $gstproc
    killall gst-launch-1.0
}

gst-launch-1.0 rtpbin name=rb do-lost=true rtp-profile=avpf do-retransmission=true latency=500 udpsrc port=5109 caps='application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H265, payload=(int)96' ! rb.recv_rtp_sink_0 rb. ! rtph265depay ! mpegtsmux name=mux ! rtpmp2tpay ! fdsink udpsrc port=5110 ! rb.recv_rtcp_sink_0 rb.send_rtcp_src_0 ! udpsink host=192.168.0.9 port=5110 sync=false async=false udpsrc port=5106 ! 'application/x-rtp, media=(string)audio, clock-rate=(int)48000, encoding-name=(string)OPUS, payload=(int)96' ! rb.recv_rtp_sink_1 rb. ! rtpopusdepay ! mux. udpsrc port=5111 ! rb.recv_rtcp_sink_1 rb.send_rtcp_src_1 ! udpsink host=192.168.0.9 port=5111 sync=false async=false | mpv --no-cache --video-sync=audio --really-quiet --no-osc --osd-on-seek=no - &
gstproc=$!

trap gst_exit INT
trap gst_exit HUP

wait $gstproc
exit 0

Reach out to me for professional support!

Contact