Skip to content

Commit fb44911

Browse files
Use compiled ffmpeg binaries
1 parent fea2806 commit fb44911

File tree

1 file changed

+4
-103
lines changed

1 file changed

+4
-103
lines changed

hls-streaming/Dockerfile

Lines changed: 4 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,14 @@
1-
###############################
2-
# Build the FFmpeg-build image.
3-
FROM --platform=linux/amd64 alpine:3.13 as build
4-
5-
ARG PREFIX=/opt/ffmpeg
6-
ARG LD_LIBRARY_PATH=/opt/ffmpeg/lib
7-
ARG MAKEFLAGS="-j4"
8-
9-
# FFmpeg build dependencies.
10-
RUN apk add --update \
11-
git \
12-
build-base \
13-
coreutils \
14-
freetype-dev \
15-
gcc \
16-
lame-dev \
17-
libogg-dev \
18-
libass \
19-
libass-dev \
20-
libvpx-dev \
21-
libvorbis-dev \
22-
libwebp-dev \
23-
libtheora-dev \
24-
opus-dev \
25-
openssl \
26-
openssl-dev \
27-
pkgconf \
28-
pkgconfig \
29-
rtmpdump-dev \
30-
wget \
31-
x264-dev \
32-
x265-dev \
33-
yasm
34-
35-
# Get fdk-aac from community.
36-
RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories && \
37-
apk add --update fdk-aac-dev
38-
39-
# Get rav1e from testing.
40-
RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \
41-
apk add --update rav1e-dev
42-
43-
# Get ffmpeg source.
44-
RUN cd /tmp/ && \
45-
git clone https://github.com/iosifnicolae2/FFmpeg.git ffmpeg
46-
47-
# Compile ffmpeg.
48-
RUN cd /tmp/ffmpeg && \
49-
./configure \
50-
--enable-version3 \
51-
--enable-gpl \
52-
--enable-nonfree \
53-
--enable-small \
54-
--enable-libmp3lame \
55-
--enable-libx264 \
56-
--enable-libx265 \
57-
--enable-libvpx \
58-
--enable-libtheora \
59-
--enable-libvorbis \
60-
--enable-libopus \
61-
--enable-libfdk-aac \
62-
--enable-libass \
63-
--enable-libwebp \
64-
--enable-librtmp \
65-
--enable-librav1e \
66-
--enable-postproc \
67-
--enable-libfreetype \
68-
--enable-openssl \
69-
--disable-debug \
70-
--disable-doc \
71-
--disable-ffplay \
72-
--extra-cflags="-I${PREFIX}/include" \
73-
--extra-ldflags="-L${PREFIX}/lib" \
74-
--extra-libs="-lpthread -lm" \
75-
--prefix="${PREFIX}" && \
76-
make && make install && make distclean
77-
78-
# Cleanup.
79-
RUN rm -rf /var/cache/apk/* /tmp/*
80-
81-
##########################
82-
# Build the release image.
831
FROM --platform=linux/amd64 alpine:3.13
84-
LABEL MAINTAINER Alfred Gutierrez <alf.g.jr@gmail.com>
85-
ENV PATH=/opt/ffmpeg/bin:$PATH
862

873
RUN apk add --update \
88-
ca-certificates \
89-
openssl \
90-
pcre \
91-
lame \
92-
libogg \
93-
libass \
94-
libvpx \
95-
libvorbis \
96-
libwebp \
97-
libtheora \
98-
opus \
99-
rtmpdump \
100-
x264-dev \
101-
x265-dev \
102-
bash
4+
bash \
5+
curl
1036

1047
RUN apk add rav1e-libs --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing
1058

106-
COPY --from=build /opt/ffmpeg /opt/ffmpeg
107-
COPY --from=build /usr/lib/libfdk-aac.so.2 /usr/lib/libfdk-aac.so.2
108-
COPY --from=build /usr/lib/librav1e.so /usr/lib/librav1e.so
9+
RUN curl -Lf# https://github.com/homebridge/ffmpeg-for-homebridge/releases/latest/download/ffmpeg-alpine-x86_64.tar.gz | tar xzf - -C / --no-same-owner
10910

11011
HEALTHCHECK --start-period=10s --interval=5s --timeout=3s \
11112
CMD [[ ! -f /data/index.m3u8 ]] && echo "is starting.." && exit 1 || s=$(( $(date +%s) - $(stat /data/index.m3u8 -c %Y) )) && [ "$s" -lt "60" ] && echo "is up" && exit 0 || echo "is down" && rm -f /data/index.m3u8 && exit 1
11213

113-
CMD ["ffmpeg"]
14+
CMD ["ffmpeg"]

0 commit comments

Comments
 (0)