forked from datarhei/ffmpeg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.alpine.rpi
140 lines (127 loc) · 4.33 KB
/
Dockerfile.alpine.rpi
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
ARG BUILD_IMAGE=alpine:3.15
FROM $BUILD_IMAGE AS builder
ARG BUILD_DATE=1970-01-01T00:00:00Z
ARG BUILD_COMMIT=unknown
ARG FFMPEG_VERSION=none
ENV PKG_CONFIG_PATH=/usr/lib/pkgconfig \
SRC=/usr
# install build packages
RUN apk add -U \
autoconf \
automake \
bash \
binutils \
bzip2 \
ca-certificates \
cmake \
coreutils \
curl \
diffutils \
g++ \
gcc \
libgcc \
libssl3 \
libtool \
linux-headers \
make \
musl-dev \
nasm \
openssl-dev \
patch \
tar \
zlib-dev \
harfbuzz-dev \
freetype-dev \
libxml2-dev \
libsrt-dev \
x264-dev \
x265-dev \
libvpx-dev \
lame-dev \
opus-dev \
libvorbis-dev \
dav1d-dev \
rav1e-dev \
alsa-lib-dev \
v4l-utils-dev \
raspberrypi-dev \
raspberrypi-libs
# install and patch ffmpeg
RUN mkdir -p /dist && cd /dist && \
curl -OLk http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz && \
tar -xvz -f ffmpeg-${FFMPEG_VERSION}.tar.gz && \
rm ffmpeg-${FFMPEG_VERSION}.tar.gz
COPY ./contrib /contrib
RUN echo $uname
RUN cd /dist/ffmpeg-${FFMPEG_VERSION} && \
apkArch="$(apk --print-arch)" && if [ $apkArch != "aarch64" ]; then MMAL_SUPPORT="--enable-mmal"; fi && \
apkArch="$(apk --print-arch)" && if [ $apkArch != "aarch64" ]; then OMX_SUPPORT="--enable-omx --enable-omx-rpi"; fi && \
patch -p1 < /contrib/ffmpeg-jsonstats.patch && \
patch -p1 < /contrib/ffmpeg-hls.patch && \
patch -p1 < /contrib/0027-avformat-mpegts-index-only-keyframes-to-ensure-accur.patch && \
patch -p1 < /contrib/0031-pass-dovi-sidedata-to-hlsenc-and-mpegtsenc.patch && \
patch -p1 < /contrib/0046-fix-libx265-encoded-fmp4-hls-playback-on-safari.patch && \
patch -p1 < /contrib/0001-add-fixes-for-segment-muxer.patch && \
patch -p1 < /contrib/FFmpeg-devel-01-13-avformat-flvenc-Implement-support-for-multi-track-video.diff && \
patch -p1 < /contrib/FFmpeg-devel-02-13-avformat-flvdec-Add-support-for-demuxing-multi-track-FLV.diff && \
patch -p1 < /contrib/FFmpeg-devel-03-13-avformat-flvenc-add-enhanced-audio-codecs.diff && \
patch -p1 < /contrib/FFmpeg-devel-04-13-avformat-flvenc-remove-size-check-for-audio-packets.diff && \
patch -p1 < /contrib/FFmpeg-devel-05-13-avformat-flvdec-add-enhanced-audio-codecs.diff && \
patch -p1 < /contrib/FFmpeg-devel-06-13-avformat-flvenc-refactor-fourcc-writing.diff && \
patch -p1 < /contrib/FFmpeg-devel-07-13-avformat-flvenc-write-enhanced-rtmp-multichannel-info-for-audio-with-more-than-two-channels.diff && \
patch -p1 < /contrib/FFmpeg-devel-08-13-avformat-flvdec-parse-enhanced-rtmp-multichannel-info.diff && \
patch -p1 < /contrib/FFmpeg-devel-09-13-avformat-flvenc-add-support-for-writing-multi-track-audio.diff && \
patch -p1 < /contrib/FFmpeg-devel-10-13-avformat-flvdec-add-support-for-reading-multi-track-audio.diff && \
patch -p1 < /contrib/FFmpeg-devel-11-13-avformat-rtmpproto-add-more-enhanced-rtmp-codecs.diff && \
patch -p1 < /contrib/FFmpeg-devel-12-13-avformat-flvdec-stop-shadowing-local-variables.diff && \
patch -p1 < /contrib/FFmpeg-devel-13-13-avformat-flvdec-support-all-multi-track-modes.diff && \
./configure \
--extra-version="datarhei-${BUILD_COMMIT}-${BUILD_DATE}" \
--prefix="${SRC}" \
--extra-libs="-lpthread -lxml2 -lm -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl" \
--enable-nonfree \
--enable-gpl \
--enable-version3 \
--enable-postproc \
--enable-static \
--enable-openssl \
--enable-libxml2 \
$OMX_SUPPORT \
$MMAL_SUPPORT \
--enable-libv4l2 \
--enable-v4l2_m2m \
--enable-alsa \
--enable-libfreetype \
--enable-libsrt \
--enable-libx264 \
--enable-libx265 \
--enable-libvpx \
--enable-libmp3lame \
--enable-libopus \
--enable-libvorbis \
--enable-libdav1d \
--enable-librav1e \
--disable-ffplay \
--disable-debug \
--disable-doc \
--disable-shared && \
make -j$(nproc) && \
make install
# export shared ffmpeg libs
RUN mkdir -p /ffmpeg/lib && \
ldd /usr/bin/ffmpeg | grep -o -e '/usr/lib/[^ ]*' | xargs -I % cp -v % /ffmpeg/lib
FROM $BUILD_IMAGE AS final
COPY --from=builder /usr/bin/ffmpeg /usr/bin/ffmpeg
COPY --from=builder /ffmpeg/lib/* /usr/lib/
RUN apk add --no-cache \
ca-certificates \
tzdata \
alsa-lib \
xf86-video-fbdev \
v4l-utils \
raspberrypi-userland && \
echo "/opt/vc/lib:/usr/local/lib:/usr/lib:/lib" > /etc/ld-musl-armhf.path && \
ffmpeg -buildconf
WORKDIR /tmp
ENTRYPOINT ["/usr/bin/ffmpeg"]
CMD ["-version"]