moq-rs/dev/pub

41 lines
1.0 KiB
Plaintext
Raw Normal View History

#!/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.
2023-10-25 06:28:47 +00:00
#NAME="${NAME:-$(head /dev/urandom | LC_ALL=C tr -dc 'a-zA-Z0-9' | head -c 16)}"
# JK use the name "dev" instead
# TODO use that random name if the host is not localhost
NAME="${NAME:-dev}"
# Combine the host and name into a URL.
URL="${URL:-"https://$ADDR/$NAME"}"
# Default to a source video
2023-10-25 06:28:47 +00:00
INPUT="${INPUT:-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
2023-10-25 06:28:47 +00:00
# TODO enable audio again once fixed.
ffmpeg -hide_banner -v quiet \
-stream_loop -1 -re \
2023-10-25 06:28:47 +00:00
-i "$INPUT" \
-c copy \
-an \
2023-10-25 06:28:47 +00:00
-f mp4 -movflags cmaf+separate_moof+delay_moov+skip_trailer \
-frag_duration 1 \
- | cargo run --bin moq-pub -- "$URL" "$@"