mirror of
https://github.com/Glimesh/broadcast-box.git
synced 2026-07-04 15:07:53 +00:00
@@ -73,7 +73,7 @@ ffmpeg \
|
||||
|
||||
### GStreamer Broadcasting
|
||||
|
||||
See the example script [here](examples/gstreamer-broadcast.nu).
|
||||
See the example script [here](examples/gstreamer-broadcast.sh).
|
||||
|
||||
Can broadcast gstreamer's test sources, or pulsesrc+v4l2src
|
||||
|
||||
@@ -83,9 +83,9 @@ Use of example scripts:
|
||||
|
||||
```shell
|
||||
# testsrcs
|
||||
./examples/gstreamer-broadcast.nu http://localhost:8080/api/whip testStream1
|
||||
./examples/gstreamer-broadcast.sh http://localhost:8080/api/whip testStream1
|
||||
# v4l2src
|
||||
./examples/gstreamer-broadcast.nu http://localhost:8080/api/whip testStream1 v4l2
|
||||
./examples/gstreamer-broadcast.sh http://localhost:8080/api/whip testStream1 v4l2
|
||||
```
|
||||
|
||||
### Playback
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
#!/usr/bin/env nu
|
||||
|
||||
def main [ whip_endpoint: string, auth_token: string, stream_type = "testsrc" ] {
|
||||
mut srcelem = []
|
||||
mut audioelem = []
|
||||
|
||||
if $stream_type == "testsrc" {
|
||||
$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" ]
|
||||
}
|
||||
|
||||
(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)"
|
||||
)
|
||||
}
|
||||
Executable
+37
@@ -0,0 +1,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"
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/usr/bin/env nu
|
||||
|
||||
def main [whep_endpoint: string, whep_token: string, rtmp_location: string] {
|
||||
(gst-launch-1.0
|
||||
flvmux
|
||||
streamable=true
|
||||
name=flvmux
|
||||
! rtmpsink
|
||||
$"location=($rtmp_location)"
|
||||
whepsrc
|
||||
name=whep
|
||||
$"auth-token=($whep_token)"
|
||||
$"whep-endpoint=($whep_endpoint)"
|
||||
video-caps="application/x-rtp,payload=127,encoding-name=H264,media=video,clock-rate=90000"
|
||||
audio-caps="application/x-rtp,payload=96,encoding-name=OPUS,media=audio,clock-rate=48000"
|
||||
! rtpopusdepay
|
||||
! fakesink
|
||||
whep.
|
||||
! rtph264depay
|
||||
! h264parse
|
||||
! queue
|
||||
! flvmux.
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
if [ "$#" -ne 3 ]; then
|
||||
echo "Usage: $0 <whep_endpoint> <whep_token> <rtmp_location>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
whep_endpoint=$1
|
||||
whep_token=$2
|
||||
rtmp_location=$3
|
||||
|
||||
gst-launch-1.0 \
|
||||
flvmux \
|
||||
streamable=true \
|
||||
name=flvmux \
|
||||
! rtmpsink \
|
||||
location="$rtmp_location" \
|
||||
whepsrc \
|
||||
name=whep \
|
||||
auth-token="$whep_token" \
|
||||
whep-endpoint="$whep_endpoint" \
|
||||
video-caps="application/x-rtp,payload=127,encoding-name=H264,media=video,clock-rate=90000" \
|
||||
audio-caps="application/x-rtp,payload=96,encoding-name=OPUS,media=audio,clock-rate=48000" \
|
||||
! rtpopusdepay \
|
||||
! fakesink \
|
||||
whep. \
|
||||
! rtph264depay \
|
||||
! h264parse \
|
||||
! queue \
|
||||
! flvmux.
|
||||
Reference in New Issue
Block a user