-
Notifications
You must be signed in to change notification settings - Fork 7
/
install_ffmpeg_x265_prod.sh
286 lines (185 loc) · 4.73 KB
/
install_ffmpeg_x265_prod.sh
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
#!/bin/bash
source installer.cfg
function display_message {
clear
echo $1
sleep 5
}
function update_sys {
display_message "Updating Ubuntu using apt-get update"
apt-get update
display_message "Installing required packages"
apt-get install -y autoconf automake build-essential mercurial git libarchive-dev fontconfig checkinstall
apt-get install -y libass-dev libfreetype6-dev libsdl1.2-dev libtheora-dev libgnutls-dev
apt-get install -y libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev pkg-config texinfo libtool libva-dev
apt-get install -y libbs2b-dev libcaca-dev libopenjpeg-dev librtmp-dev libvpx-dev libvdpau-dev
apt-get install -y libwavpack-dev libxvidcore-dev lzma-dev liblzma-dev zlib1g-dev cmake-curses-gui
apt-get install -y libx11-dev libxfixes-dev libmp3lame-dev libx264-dev libbz2-dev libbluray-dev
sleep 5
}
function install_libnuma {
NUMA_LIB="numactl-2.0.11.tar.gz"
NUMA_PATH=$(basename ${NUMA_LIB} .tar.gz)
cd ${SOURCE_PREFIX}
if [ ! -d "${NUMA_PATH}" ];then
wget -O ${NUMA_LIB} "ftp://oss.sgi.com/www/projects/libnuma/download/${NUMA_LIB}"
fi
tar xfzv ${NUMA_LIB}
cd ${NUMA_PATH}
./configure
make
make install
sleep 5
}
function install_libopus {
OPUS_LIB=opus-1.1.2.tar.gz
OPUS_PATH=$(basename ${OPUS_LIB} .tar.gz)
cd ${SOURCE_PREFIX}
if [ ! -d "${OPUS_PATH}" ];then
wget http://downloads.xiph.org/releases/opus/${OPUS_LIB}
fi
tar xzvf ${OPUS_LIB}
cd ${OPUS_PATH}
./configure --prefix="${INST_PREFIX}" --disable-shared
make
make install
make check
make clean
sleep 5
}
function install_cmake {
cd ${SOURCE_PREFIX}
#Need further testing
if [ ! -d "CMake" ];then
git clone https://github.com/Kitware/CMake
fi
cd CMake
./bootstrap --prefix="/usr/local"
make
make install
sleep 5
}
function install_aac {
AAC_LIB="fdk-aac.tar.gz"
cd ${SOURCE_PREFIX}
if [ ! -d "mstorsjo-fdk-aac*" ];then
wget -O ${AAC_LIB} https://github.com/mstorsjo/fdk-aac/tarball/master
fi
tar xzvf ${AAC_LIB}
cd mstorsjo-fdk-aac*
autoreconf -fiv
./configure --prefix="${INST_PREFIX}" --disable-shared
make
make install
make distclean
sleep 5
}
function install_yasm {
cd ${SOURCE_PREFIX}
if [ ! -d "yasm" ];then
git clone git://github.com/yasm/yasm.git
fi
cd yasm
./autogen.sh
./configure
make
make install
sleep 5
}
function install_x265 {
cd ${SOURCE_PREFIX}
if [ ! -d "x265" ];then
hg clone https://bitbucket.org/multicoreware/x265
fi
cd x265/build/linux
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${INST_PREFIX}" ../../source
make
make install
sleep 5
}
function install_ffmpeg {
cd ${SOURCE_PREFIX}
if [ ! -d "ffmpeg" ];then
git clone git://source.ffmpeg.org/ffmpeg.git
fi
cd ffmpeg
PKG_CONFIG_PATH="${INST_PREFIX}/pkgconfig" \
./configure --prefix="${INST_PREFIX}" \
--pkg-config-flags="--static" \
--extra-cflags="-I${INST_PREFIX}/include" \
--extra-ldflags="-L${INST_PREFIX}/lib" \
--enable-gpl \
--enable-libass \
--enable-libbluray \
--enable-fontconfig \
--enable-bzlib \
--enable-gnutls \
--enable-libbs2b \
--enable-libcaca \
--enable-zlib \
--enable-libopenjpeg \
--enable-librtmp \
--enable-libvo-amrwbenc \
--enable-libwavpack \
--enable-lzma \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopus \
--enable-libtheora \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 \
--enable-nonfree \
--enable-version3 \
--arch=x86_64 \
--enable-yasm
make
make install
sleep 5
}
function testing {
cd ${SOURCE_PREFIX}
"${INST_PREFIX}"/bin/ffmpeg -i ${TEST_VID} -c:v libx265 -c:a aac test.mp4
if [ $? -eq 0 ];then
echo "TEST PASSED!"
else
echo "TEST FAILED!. CONTAINS ERRORS!"
exit
fi
sleep 5
}
display_message "Update Ubuntu System"
update_sys
#if [ ! -d ${SOURCE_PREFIX} ];then
# mkdir ${SOURCE_PREFIX}
#fi
if [ ${SOURCE_PREFIX} != "/usr" ];then
mkdir ${INST_PREFIX}
fi
#Install Latest libnuma
display_message "Installing libnuma-dev"
install_libnuma
#Install libopus
display_message "Installing libopus-dev"
install_libopus
#Install CMAKE
display_message "Installing CMake" | tee logfile
install_cmake
#Install latest libfdk-aac-dev
display_message "Installing fdk-aac" | tee logfile
install_aac
#Install latest YASM
display_message "Installing YASM" | tee logfile
install_yasm
#Use the latest x265 codec
display_message "Installing libx265-dev" | tee logfile
install_x265
#Install ffmpeg
display_message "Installing ffmpeg" | tee logfile
install_ffmpeg
#Conduct testing
display_message "Conduct testing"
testing
echo "DONE!"
sleep 5