moq-gst 0.1.0

Media over QUIC - gstreamer plugin
Documentation
#!/bin/bash
set -euo pipefail

# Change directory to the root of the project
cd "$(dirname "$0")"

# Use info logging by default
export RUST_LOG="${RUST_LOG:-info}"

# Connect to localhost by default.
HOST="${HOST:-localhost}"
PORT="${PORT:-4443}"
ADDR="${ADDR:-$HOST:$PORT}"
SCHEME="${SCHEME:-https}"

# Use the name "bbb" for the broadcast.
NAME="${NAME:-bbb}"

# Combine the host into a URL.
URL="${URL:-"$SCHEME://$ADDR"}"

# Default to a source video
INPUT="${INPUT:-bbb.mp4}"

# Print out the watch URL
echo "Watch URL: https://quic.video/watch/$NAME?server=$ADDR"

# Make sure we build the gstreamer plugin
cargo build

export GST_PLUGIN_PATH="${PWD}/target/debug${GST_PLUGIN_PATH:+:$GST_PLUGIN_PATH}"
#export GST_DEBUG=*:5

# Download the Big Buck Bunny video if it doesn't exist
if [[ $INPUT == "bbb.mp4" && ! -f $INPUT ]]; then
	echo "Downloading ya boye Big Buck Bunny..."
	wget http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4 -O bbb.mp4
fi

# Run gstreamer and pipe the output to moq-pub
gst-launch-1.0 -v -e multifilesrc location="$INPUT" loop=true ! qtdemux name=demux \
    demux.video_0 ! h264parse ! queue ! identity sync=true ! isofmp4mux name=mux chunk-duration=1 fragment-duration=1 ! moqsink url="$URL" path="$NAME" \
    # demux.audio_0 ! aacparse ! queue ! mux.