-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathDockerfile
142 lines (126 loc) · 4.54 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
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
141
142
FROM lambci/lambda-base:build
# Using instructions from:
# https://trac.ffmpeg.org/wiki/CompilationGuide/Centos
RUN yum install -y install autoconf \
automake \
bzip2 \
bzip2-devel \
cmake \
freetype-devel \
gcc \
gcc-c++ \
git \
libtool \
make \
mercurial \
pkgconfig \
zlib-devel \
libfdk-aac-dev
RUN mkdir ~/ffmpeg_sources
# Install Nasm
# An assembler used by some libraries. Highly recommended or your resulting build may be very slow.
RUN cd ~/ffmpeg_sources && \
curl -O -L https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/nasm-2.14.02.tar.bz2 && \
tar xjvf nasm-2.14.02.tar.bz2 && \
cd nasm-2.14.02 && \
./autogen.sh && \
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \
PATH="$HOME/bin:$PATH" make && \
make install
# Install Yasm
# An assembler used by some libraries. Highly recommended or your resulting build may be very slow.
RUN cd ~/ffmpeg_sources && \
curl -O -L https://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz && \
tar xzvf yasm-1.3.0.tar.gz && \
cd yasm-1.3.0 && \
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \
make && \
make install
# Install libx264
# H.264 video encoder.
RUN cd ~/ffmpeg_sources && \
git clone --depth 1 https://code.videolan.org/videolan/x264.git && \
cd x264 && \
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static && \
PATH="$HOME/bin:$PATH" make && \
make install
# Install libx265
# H.265/HEVC video encoder.
RUN cd ~/ffmpeg_sources && \
hg clone https://bitbucket.org/multicoreware/x265 && \
cd ~/ffmpeg_sources/x265/build/linux && \
PATH="$HOME/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source && \
PATH="$HOME/bin:$PATH" make && \
make install
# Install libfdk_aac
# AAC audio encoder.
RUN cd ~/ffmpeg_sources && \
git clone --depth 1 https://github.com/mstorsjo/fdk-aac && \
cd fdk-aac && \
autoreconf -fiv && \
PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --disable-shared && \
PATH="$HOME/bin:$PATH" make && \
make install
# Install libmp3lame
# MP3 audio encoder.
RUN cd ~/ffmpeg_sources && \
curl -O -L https://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz && \
tar xzvf lame-3.100.tar.gz && \
cd lame-3.100 && \
PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --disable-shared --enable-nasm && \
PATH="$HOME/bin:$PATH" make && \
make install
# Install libopus
# Opus audio decoder and encoder
RUN cd ~/ffmpeg_sources && \
curl -O -L https://archive.mozilla.org/pub/opus/opus-1.3.1.tar.gz && \
tar xzvf opus-1.3.1.tar.gz && \
cd opus-1.3.1 && \
PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --disable-shared && \
PATH="$HOME/bin:$PATH" make && \
make install
# Install libvpx
# VP8/VP9 video encoder and decoder.
RUN cd ~/ffmpeg_sources && \
git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && \
cd libvpx && \
PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm && \
PATH="$HOME/bin:$PATH" make && \
make install
ARG FFMPEG_VERSION
# Install ffmpeg
RUN cd ~/ffmpeg_sources && \
curl -O -L https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && \
tar xjvf ffmpeg-snapshot.tar.bz2 && \
cd ffmpeg && \
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
--prefix="$HOME/ffmpeg_build" \
--pkg-config-flags="--static" \
--extra-cflags="-I$HOME/ffmpeg_build/include" \
--extra-ldflags="-L$HOME/ffmpeg_build/lib" \
--extra-libs=-lpthread \
--extra-libs=-lm \
--bindir="$HOME/bin" \
--enable-gpl \
--enable-libfdk_aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopus \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 \
--enable-nonfree && \
PATH="$HOME/bin:$PATH" make && \
PATH="$HOME/bin:$PATH" make install
RUN mkdir -p $HOME/lib && \
cp /usr/lib64/libxcb*.so.* $HOME/lib && \
cp /usr/lib64/libfreetype*.so.* $HOME/lib && \
cp /usr/lib64/libbz2*.so $HOME/lib && \
cp /usr/lib64/libbz2.so $HOME/lib/libbz2.so.1 && \
cp /usr/lib64/liblzma.so* $HOME/lib && \
cp /usr/lib64/libXau.so* $HOME/lib
RUN rm -rf $HOME/ffmpeg_sources && \
rm -rf $HOME/ffmpeg_build
RUN cd $HOME && \
find . ! -perm -o=r -exec chmod +400 {} \; && \
zip -yr /tmp/ffmpeg-${FFMPEG_VERSION}.zip ./