-
Notifications
You must be signed in to change notification settings - Fork 61
/
pub
executable file
·40 lines (33 loc) · 1.11 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
#!/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 default "demo/bbb" for the broadcast.
NAME="${NAME:-demo/bbb}"
URL="${URL:-"$SCHEME://$ADDR/$NAME"}"
# Default to a source video
INPUT="${INPUT:-dev/bbb.fmp4}"
# Run ffmpeg and pipe the output to moq-pub
ffmpeg -hide_banner -v quiet \
-stream_loop -1 -re \
-i "$INPUT" \
-c copy \
-f mp4 -movflags cmaf+separate_moof+delay_moov+skip_trailer+frag_every_frame \
- | cargo run --bin moq-karp -- "$@" publish "$URL"