34 lines
884 B
Bash
Executable File
34 lines
884 B
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
# Change directory to the root of the project
|
|
cd "$(dirname "$0")/.."
|
|
|
|
# Use debug logging by default
|
|
export RUST_LOG="${RUST_LOG:-debug}"
|
|
|
|
# Connect to localhost by default.
|
|
HOST="${HOST:-localhost}"
|
|
PORT="${PORT:-4443}"
|
|
ADDR="${ADDR:-$HOST:$PORT}"
|
|
|
|
# Generate a random 16 character name by default.
|
|
NAME="${NAME:-$(head /dev/urandom | LC_ALL=C tr -dc 'a-zA-Z0-9' | head -c 16)}"
|
|
|
|
# Combine the host and name into a URL.
|
|
URL="${URL:-"https://$ADDR/$NAME"}"
|
|
|
|
# Default to a source video
|
|
MEDIA="${MEDIA:-dev/source.mp4}"
|
|
|
|
# Print out the watch URL
|
|
echo "Watch URL: https://quic.video/watch/$NAME?server=$ADDR"
|
|
|
|
# Run ffmpeg and pipe the output to moq-pub
|
|
ffmpeg -hide_banner -v quiet \
|
|
-stream_loop -1 -re \
|
|
-i "$MEDIA" \
|
|
-an \
|
|
-f mp4 -movflags empty_moov+frag_every_frame+separate_moof+omit_tfhd_offset - \
|
|
| cargo run --bin moq-pub -- "$URL" "$@"
|