set -euo pipefail
cd "$(dirname "$0")"
export RUST_LOG="${RUST_LOG:-info}"
HOST="${HOST:-localhost}"
PORT="${PORT:-4443}"
ADDR="${ADDR:-$HOST:$PORT}"
SCHEME="${SCHEME:-https}"
NAME="${NAME:-bbb}"
URL="${URL:-"$SCHEME://$ADDR"}"
INPUT="${INPUT:-bbb.mp4}"
echo "Watch URL: https://quic.video/watch/$NAME?server=$ADDR"
cargo build
export GST_PLUGIN_PATH="${PWD}/target/debug${GST_PLUGIN_PATH:+:$GST_PLUGIN_PATH}"
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
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" \