/
Dockerfile
46 lines (40 loc) · 1.29 KB
/
Dockerfile
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
# syntax=docker/dockerfile:1.6
# see https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/reference.md
# see https://hub.docker.com/r/docker/dockerfile
FROM alpine:3.19
RUN <<"EOF"
set -euxo pipefail
apk --no-cache add \
ffmpeg \
font-dejavu
EOF
# NB to be compatible with most WebRTC clients, use the YUV420p pixel format
# and the H.264 video codec without B-frames (i.e. the baseline profile).
# see https://trac.ffmpeg.org/wiki/Encode/H.264
RUN <<"EOF"
set -euxo pipefail
ffmpeg \
-f lavfi \
-i 'smptebars=duration=120:size=640x360:rate=30' \
-filter:v "drawtext=text='%{pts\\:hms} #%{n}':x=-5:y=3:fontsize=53:fontcolor=white:box=1:boxborderw=3:boxcolor=black:fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf" \
-c:v libx264 \
-profile:v baseline \
-pix_fmt yuv420p \
-preset ultrafast \
-tune stillimage \
-movflags +faststart \
-b:v 600k \
smptebars.mp4
EOF
# see https://github.com/bluenviron/mediamtx/releases
RUN <<"EOF"
set -euxo pipefail
install -d /tmp/mediamtx
wget -qO- \
https://github.com/bluenviron/mediamtx/releases/download/v1.5.1/mediamtx_v1.5.1_linux_amd64.tar.gz \
| tar xzf - -C /tmp/mediamtx
install /tmp/mediamtx/mediamtx /
rm -rf /tmp/mediamtx
EOF
COPY mediamtx.yml .
ENTRYPOINT ["/mediamtx"]