-
Notifications
You must be signed in to change notification settings - Fork 60
/
pub
executable file
·46 lines (37 loc) · 1.24 KB
/
pub
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
set -euo pipefail
# Change directory to the root of the project
cd "$(dirname "$0")/.."
# Download the Big Buck Bunny video if it doesn't exist
if [ ! -f dev/bbb.fmp4 ]; then
if [ ! -f dev/bbb.mp4 ]; then
echo "Downloading ya boye Big Buck Bunny..."
wget http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4 -O dev/bbb.mp4
fi
echo "Converting to a (properly) fragmented MP4..."
ffmpeg -i dev/bbb.mp4 \
-c copy \
-f mp4 -movflags cmaf+separate_moof+delay_moov+skip_trailer+frag_every_frame \
dev/bbb.fmp4
fi
# 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:-dev/bbb.fmp4}"
# 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 "$INPUT" \
-c copy \
-an \
-f mp4 -movflags cmaf+separate_moof+delay_moov+skip_trailer+frag_every_frame \
- | cargo run --bin moq-karp -- --url "$URL" --path "$NAME" "$@" publish