forked from Glimesh/broadcast-box
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgstreamer-broadcast.sh
More file actions
executable file
·37 lines (33 loc) · 981 Bytes
/
gstreamer-broadcast.sh
File metadata and controls
executable file
·37 lines (33 loc) · 981 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env sh
if [ "$#" -lt 2 ] || [ "$#" -gt 3 ]; then
echo "Usage: $0 <whip_endpoint> <auth_token> [testsrc|v4l2]" >&2
exit 1
fi
whip_endpoint=$1
auth_token=$2
stream_type=${3:-testsrc}
if [ "$stream_type" = "testsrc" ]; then
srcelem="videotestsrc pattern=smpte-rp-219"
audioelem="audiotestsrc wave=8"
else
srcelem="v4l2src device=/dev/video1"
audioelem="pulsesrc device=alsa_input.usb-MACROSILICON_USB3._0_capture-02.analog-stereo"
fi
gst-launch-1.0 -v \
$srcelem \
! videoconvert \
! x264enc tune=zerolatency \
! rtph264pay \
! "application/x-rtp,media=video,encoding-name=H264,payload=97,clock-rate=90000" \
! whip0.sink_0 \
$audioelem \
! audioconvert \
! opusenc \
! rtpopuspay \
! "application/x-rtp,media=audio,encoding-name=OPUS,payload=96,clock-rate=48000,encoding-params=(string)2" \
! whip0.sink_1 \
whipsink \
name=whip0 \
use-link-headers=true \
whip-endpoint="$whip_endpoint" \
auth-token="$auth_token"