Also build the moq-pub image in this repo. (#116)
This commit is contained in:
parent
ddfe7963e6
commit
ea701bcf7e
|
@ -1,2 +1,3 @@
|
||||||
target
|
target
|
||||||
dev
|
dev
|
||||||
|
*.mp4
|
||||||
|
|
|
@ -6,7 +6,8 @@ on:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: docker.io
|
REGISTRY: docker.io
|
||||||
IMAGE: ${{ github.repository }}
|
IMAGE: kixelated/moq-rs
|
||||||
|
IMAGE-PUB: kixelated/moq-pub
|
||||||
SERVICE: api # Restart the API service TODO and relays
|
SERVICE: api # Restart the API service TODO and relays
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
@ -42,6 +43,16 @@ jobs:
|
||||||
tags: ${{env.REGISTRY}}/${{env.IMAGE}}
|
tags: ${{env.REGISTRY}}/${{env.IMAGE}}
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
|
|
||||||
|
# Same, but include ffmpeg for publishing BBB
|
||||||
|
- uses: depot/build-push-action@v1
|
||||||
|
with:
|
||||||
|
project: r257ctfqm6
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
target: moq-pub # instead of the default target
|
||||||
|
tags: ${{env.REGISTRY}}/${{env.IMAGE-PUB}}
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
|
||||||
# Log in to GCP
|
# Log in to GCP
|
||||||
- uses: google-github-actions/auth@v1
|
- uses: google-github-actions/auth@v1
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
.DS_Store
|
.DS_Store
|
||||||
target/
|
target/
|
||||||
logs/
|
logs/
|
||||||
|
*.mp4
|
||||||
|
|
20
Dockerfile
20
Dockerfile
|
@ -12,14 +12,28 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
||||||
--mount=type=cache,target=/build/target \
|
--mount=type=cache,target=/build/target \
|
||||||
cargo build --release && cp /build/target/release/moq-* /usr/local/cargo/bin
|
cargo build --release && cp /build/target/release/moq-* /usr/local/cargo/bin
|
||||||
|
|
||||||
# Runtime image
|
# Special image for moq-pub with ffmpeg and a publish script included.
|
||||||
FROM rust:latest
|
FROM rust:latest as moq-pub
|
||||||
|
|
||||||
|
# Install required utilities and ffmpeg
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y ffmpeg wget
|
||||||
|
|
||||||
|
# Copy the publish script into the image
|
||||||
|
COPY deploy/publish.sh /usr/local/bin/publish
|
||||||
|
|
||||||
|
# Copy the compiled binary
|
||||||
|
COPY --from=builder /usr/local/cargo/bin/moq-pub /usr/local/cargo/bin/moq-pub
|
||||||
|
CMD [ "publish" ]
|
||||||
|
|
||||||
|
# moq-rs image with just the binaries
|
||||||
|
FROM rust:latest as moq-rs
|
||||||
|
|
||||||
LABEL org.opencontainers.image.source=https://github.com/kixelated/moq-rs
|
LABEL org.opencontainers.image.source=https://github.com/kixelated/moq-rs
|
||||||
LABEL org.opencontainers.image.licenses="MIT OR Apache-2.0"
|
LABEL org.opencontainers.image.licenses="MIT OR Apache-2.0"
|
||||||
|
|
||||||
# Fly.io entrypoint
|
# Fly.io entrypoint
|
||||||
ADD fly-relay.sh .
|
ADD deploy/fly-relay.sh .
|
||||||
|
|
||||||
# Copy the compiled binaries
|
# Copy the compiled binaries
|
||||||
COPY --from=builder /usr/local/cargo/bin /usr/local/cargo/bin
|
COPY --from=builder /usr/local/cargo/bin /usr/local/cargo/bin
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
app = "englishm-moq-relay"
|
||||||
|
kill_signal = "SIGINT"
|
||||||
|
kill_timeout = 5
|
||||||
|
|
||||||
|
[env]
|
||||||
|
PORT = "4443"
|
||||||
|
|
||||||
|
[experimental]
|
||||||
|
cmd = "./fly-relay.sh"
|
||||||
|
|
||||||
|
[[services]]
|
||||||
|
internal_port = 4443
|
||||||
|
protocol = "udp"
|
||||||
|
|
||||||
|
[services.concurrency]
|
||||||
|
hard_limit = 25
|
||||||
|
soft_limit = 20
|
||||||
|
|
||||||
|
[[services.ports]]
|
||||||
|
port = "4443"
|
|
@ -0,0 +1,41 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
ADDR=${ADDR:-"https://relay.quic.video"}
|
||||||
|
NAME=${NAME:-"bbb"}
|
||||||
|
URL=${URL:-"http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"}
|
||||||
|
|
||||||
|
# Download the funny bunny
|
||||||
|
wget -nv "${URL}" -O "${NAME}.mp4"
|
||||||
|
|
||||||
|
# ffmpeg
|
||||||
|
# -hide_banner: Hide the banner
|
||||||
|
# -v quiet: and any other output
|
||||||
|
# -stats: But we still want some stats on stderr
|
||||||
|
# -stream_loop -1: Loop the broadcast an infinite number of times
|
||||||
|
# -re: Output in real-time
|
||||||
|
# -i "${INPUT}": Read from a file on disk
|
||||||
|
# -vf "drawtext": Render the current time in the corner of the video
|
||||||
|
# -an: Disable audio for now
|
||||||
|
# -b:v 3M: Output video at 3Mbps
|
||||||
|
# -preset ultrafast: Don't use much CPU at the cost of quality
|
||||||
|
# -tune zerolatency: Optimize for latency at the cost of quality
|
||||||
|
# -f mp4: Output to mp4 format
|
||||||
|
# -movflags: Build a fMP4 file with a frame per fragment
|
||||||
|
# - | moq-pub: Output to stdout and moq-pub to publish
|
||||||
|
|
||||||
|
# Run ffmpeg
|
||||||
|
ffmpeg \
|
||||||
|
-stream_loop -1 \
|
||||||
|
-hide_banner \
|
||||||
|
-v quiet \
|
||||||
|
-re \
|
||||||
|
-i "${NAME}.mp4" \
|
||||||
|
-vf "drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf:text='%{gmtime\: %H\\\\\:%M\\\\\:%S.%3N}':x=(W-tw)-24:y=24:fontsize=48:fontcolor=white:box=1:boxcolor=black@0.5" \
|
||||||
|
-an \
|
||||||
|
-b:v 3M \
|
||||||
|
-preset ultrafast \
|
||||||
|
-tune zerolatency \
|
||||||
|
-f mp4 \
|
||||||
|
-movflags empty_moov+frag_every_frame+separate_moof+omit_tfhd_offset \
|
||||||
|
- | moq-pub "${ADDR}/${NAME}"
|
19
fly.toml
19
fly.toml
|
@ -1,19 +0,0 @@
|
||||||
app = "englishm-moq-relay"
|
|
||||||
kill_signal = "SIGINT"
|
|
||||||
kill_timeout = 5
|
|
||||||
|
|
||||||
[env]
|
|
||||||
PORT = "4443"
|
|
||||||
|
|
||||||
[experimental]
|
|
||||||
cmd = "./fly-relay.sh"
|
|
||||||
|
|
||||||
[[services]]
|
|
||||||
internal_port = 4443
|
|
||||||
protocol = "udp"
|
|
||||||
[services.concurrency]
|
|
||||||
hard_limit = 25
|
|
||||||
soft_limit = 20
|
|
||||||
|
|
||||||
[[services.ports]]
|
|
||||||
port = "4443"
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "moq-pub"
|
name = "moq-pub"
|
||||||
description = "Media over QUIC"
|
description = "Media over QUIC"
|
||||||
authors = ["Mike English"]
|
authors = ["Mike English", "Luke Curley"]
|
||||||
repository = "https://github.com/kixelated/moq-rs"
|
repository = "https://github.com/kixelated/moq-rs"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue