Skip to content

Commit a7019ef

Browse files
abhiTronixskvark
authored andcommitted
Added OpenSSL & various protocol support to FFmpeg backend (#229)
* Added OpenSSL & different protocol support to FFmpeg backend - Fixed Docker dependencies (both x86 & x86-64) - Fixes bug #204 * Additional Fixes - updates to OpenSSL build from scratch - removed specific protocol - Added neccessary dependency * Fixed ./Configure command * Updates for docker images: - Added perl build from scratch - Fixed wrong/redundant dependencies/paths - Fixed & updated openssl installation * Fixed Empty continuation lines bug & added comments * fix inconsitent spacing * Don't add perl 5.10 to PATH * fix syntax error * Fixed OpenSSL build fails in i686 Dockerfile due to buggy perl source * Fixing manylinux docker entrypoint for i686 in 32 bit images * ENTRYPOINT not needed, it only affects "docker run" invocations * manylinux1 provides better libcurl for cmake * manylinux1 provides the toolchain and git git install fails in i686, too * cleanup tar invocations * nasm is not installed in manylinux1 * detect i686 in openssl configure * move perl to a separate subtree as it's a private dependency * rm it after library build * comment unusual openssl build step * avoid redundant work in perl build * build each library in a separate dockerfile command for easier debugging * comment custom i686 step * update dockerfile README * opencv now bundles libjpeg-turbo and the separate's onre buid fails dueto expired certificate at https://kent.dl.sourceforge.net
1 parent a229f27 commit a7019ef

File tree

3 files changed

+99
-73
lines changed

3 files changed

+99
-73
lines changed

Diff for: docker/Dockerfile_i686

+51-35
Original file line numberDiff line numberDiff line change
@@ -14,43 +14,74 @@ ENV QTDIR /opt/Qt4.8.7
1414
ENV PATH "$QTDIR/bin:$PATH"
1515

1616
RUN curl -O -L https://cmake.org/files/v3.9/cmake-3.9.0.tar.gz && \
17-
tar -zxf cmake-3.9.0.tar.gz && \
17+
tar -xf cmake-3.9.0.tar.gz && \
1818
cd cmake-3.9.0 && \
19-
yum -y install curl-devel zlib-devel && \
19+
true '#manylinux1 provides curl-devel equivalent and libcurl statically linked \
20+
against the same newer OpenSSL as other source-built tools \
21+
(1.0.2s as of this writing)' && \
22+
yum -y install zlib-devel && \
2023
./configure --system-curl && \
21-
make && \
24+
make -j4 && \
2225
make install && \
2326
cd .. && \
2427
rm -rf cmake-3.9.0*
2528

26-
RUN yum install autoconf automake bzip2 cmake freetype-devel gcc gcc-c++ libtool make mercurial pkgconfig zlib-devel -y && \
27-
yum remove nasm -y && \
28-
mkdir ~/ffmpeg_sources && \
29-
cd ~/ffmpeg_sources && \
29+
# https://trac.ffmpeg.org/wiki/CompilationGuide/Centos#GettheDependencies
30+
# manylinux provides the toolchain and git; we provide cmake
31+
RUN yum install freetype-devel bzip2-devel zlib-devel -y && \
32+
mkdir ~/ffmpeg_sources
33+
34+
# Newer openssl configure requires newer perl
35+
RUN curl -O -L https://www.cpan.org/src/5.0/perl-5.20.1.tar.gz && \
36+
tar -xf perl-5.20.1.tar.gz && \
37+
cd perl-5.20.1 && \
38+
./Configure -des -Dprefix="$HOME/openssl_build" && \
39+
true '#perl build scripts do much redundant work \
40+
if running "make install" separately' && \
41+
make install -j4 && \
42+
cd .. && \
43+
rm -rf perl-5.20.1*
44+
45+
RUN cd ~/ffmpeg_sources && \
46+
curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_1_1_1c.tar.gz && \
47+
tar -xf OpenSSL_1_1_1c.tar.gz && \
48+
cd openssl-OpenSSL_1_1_1c && \
49+
true '#in i686, ./config detects x64 in i686 without linux32 \
50+
when run from "docker build"' && \
51+
PERL="$HOME/openssl_build/bin/perl" linux32 ./config --prefix="$HOME/ffmpeg_build" --openssldir="$HOME/ffmpeg_build" shared zlib && \
52+
make -j4 && \
53+
true '#skip installing documentation' && \
54+
make install_sw && \
55+
rm -rf ~/openssl_build
56+
57+
RUN cd ~/ffmpeg_sources && \
3058
curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/2.13.02/nasm-2.13.02.tar.bz2 && \
31-
tar xjvf nasm-2.13.02.tar.bz2 && cd nasm-2.13.02 && ./autogen.sh && \
59+
tar -xf nasm-2.13.02.tar.bz2 && cd nasm-2.13.02 && ./autogen.sh && \
3260
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \
3361
make -j4 && \
34-
make install && \
35-
cd ~/ffmpeg_sources && \
62+
make install
63+
64+
RUN cd ~/ffmpeg_sources && \
3665
curl -O -L http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz && \
37-
tar xzvf yasm-1.3.0.tar.gz && \
66+
tar -xf yasm-1.3.0.tar.gz && \
3867
cd yasm-1.3.0 && \
3968
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \
4069
make -j4 && \
41-
make install && \
42-
cd ~/ffmpeg_sources && \
70+
make install
71+
72+
RUN cd ~/ffmpeg_sources && \
4373
git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && \
4474
cd libvpx && \
4575
./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \
4676
make -j4 && \
47-
make install && \
48-
cd ~/ffmpeg_sources && \
77+
make install
78+
79+
RUN cd ~/ffmpeg_sources && \
4980
curl -O -L https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && \
50-
tar xjvf ffmpeg-snapshot.tar.bz2 && \
81+
tar -xf ffmpeg-snapshot.tar.bz2 && \
5182
cd ffmpeg && \
5283
PATH=~/bin:$PATH && \
53-
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \
84+
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \
5485
make -j4 && \
5586
make install && \
5687
echo "/root/ffmpeg_build/lib/" >> /etc/ld.so.conf && \
@@ -60,30 +91,15 @@ RUN yum install autoconf automake bzip2 cmake freetype-devel gcc gcc-c++ libtool
6091
ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/root/ffmpeg_build/lib/pkgconfig
6192
ENV LDFLAGS -L/root/ffmpeg_build/lib
6293

63-
RUN mkdir libjpeg-turbo && \
64-
cd libjpeg-turbo && \
65-
export PATH=~/bin:$PATH && \
66-
curl -L https://kent.dl.sourceforge.net/project/libjpeg-turbo/1.5.3/libjpeg-turbo-1.5.3.tar.gz > libjpeg-turbo-1.5.3.tar.gz && \
67-
tar xzvf libjpeg-turbo-1.5.3.tar.gz && \
68-
cd libjpeg-turbo-1.5.3 && \
69-
export CFLAGS="-fPIC" && \
70-
export CXXFLAGS="-fPIC" && \
71-
autoreconf -fiv && \
72-
./configure --host=i686-pc-linux-gnu && \
73-
make && \
74-
make install && \
75-
cd ../../ && \
76-
rm -rf libjpeg-turbo
77-
78-
ENV JPEG_LIBRARY /opt/libjpeg-turbo/lib32/libjpeg.a
79-
ENV JPEG_INCLUDE_DIR /opt/libjpeg-turbo/include
80-
8194
RUN curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/uapi/linux/videodev2.h && \
8295
curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/uapi/linux/v4l2-common.h && \
8396
curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/uapi/linux/v4l2-controls.h && \
8497
curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/linux/compiler.h && \
8598
mv videodev2.h v4l2-common.h v4l2-controls.h compiler.h /usr/include/linux
8699

100+
#in i686, yum metadata ends up with slightly wrong timestamps
101+
#which inhibits its update
102+
#https://github.com/skvark/opencv-python/issues/148
87103
RUN yum clean all
88104

89105
ENV PATH "$HOME/bin:$PATH"

Diff for: docker/Dockerfile_x86_64

+47-36
Original file line numberDiff line numberDiff line change
@@ -14,43 +14,72 @@ ENV QTDIR /opt/Qt4.8.7
1414
ENV PATH "$QTDIR/bin:$PATH"
1515

1616
RUN curl -O -L https://cmake.org/files/v3.9/cmake-3.9.0.tar.gz && \
17-
tar -zxf cmake-3.9.0.tar.gz && \
17+
tar -xf cmake-3.9.0.tar.gz && \
1818
cd cmake-3.9.0 && \
19-
yum -y install curl-devel zlib-devel && \
19+
true '#manylinux1 provides curl-devel equivalent and libcurl statically linked \
20+
against the same newer OpenSSL as other source-built tools \
21+
(1.0.2s as of this writing)' && \
22+
yum -y install zlib-devel && \
2023
./configure --system-curl && \
21-
make && \
24+
make -j4 && \
2225
make install && \
2326
cd .. && \
2427
rm -rf cmake-3.9.0*
2528

26-
RUN yum install autoconf automake bzip2 cmake freetype-devel gcc gcc-c++ libtool make mercurial pkgconfig zlib-devel -y && \
27-
yum remove nasm -y && \
28-
mkdir ~/ffmpeg_sources && \
29-
cd ~/ffmpeg_sources && \
29+
# https://trac.ffmpeg.org/wiki/CompilationGuide/Centos#GettheDependencies
30+
# manylinux provides the toolchain and git; we provide cmake
31+
RUN yum install freetype-devel bzip2-devel zlib-devel -y && \
32+
mkdir ~/ffmpeg_sources
33+
34+
# Newer openssl configure requires newer perl
35+
RUN curl -O -L https://www.cpan.org/src/5.0/perl-5.20.1.tar.gz && \
36+
tar -xf perl-5.20.1.tar.gz && \
37+
cd perl-5.20.1 && \
38+
./Configure -des -Dprefix="$HOME/openssl_build" && \
39+
true '#perl build scripts do much redundant work \
40+
if running "make install" separately' && \
41+
make install -j4 && \
42+
cd .. && \
43+
rm -rf perl-5.20.1*
44+
45+
RUN cd ~/ffmpeg_sources && \
46+
curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_1_1_1c.tar.gz && \
47+
tar -xf OpenSSL_1_1_1c.tar.gz && \
48+
cd openssl-OpenSSL_1_1_1c && \
49+
PERL="$HOME/openssl_build/bin/perl" ./config --prefix="$HOME/ffmpeg_build" --openssldir="$HOME/ffmpeg_build" shared zlib && \
50+
make -j4 && \
51+
true '#skip installing documentation' && \
52+
make install_sw && \
53+
rm -rf ~/openssl_build
54+
55+
RUN cd ~/ffmpeg_sources && \
3056
curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/2.13.02/nasm-2.13.02.tar.bz2 && \
31-
tar xjvf nasm-2.13.02.tar.bz2 && cd nasm-2.13.02 && ./autogen.sh && \
57+
tar -xf nasm-2.13.02.tar.bz2 && cd nasm-2.13.02 && ./autogen.sh && \
3258
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \
3359
make -j4 && \
34-
make install && \
35-
cd ~/ffmpeg_sources && \
60+
make install
61+
62+
RUN cd ~/ffmpeg_sources && \
3663
curl -O -L http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz && \
37-
tar xzvf yasm-1.3.0.tar.gz && \
64+
tar -xf yasm-1.3.0.tar.gz && \
3865
cd yasm-1.3.0 && \
3966
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \
4067
make -j4 && \
41-
make install && \
42-
cd ~/ffmpeg_sources && \
68+
make install
69+
70+
RUN cd ~/ffmpeg_sources && \
4371
git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && \
4472
cd libvpx && \
4573
./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \
4674
make -j4 && \
47-
make install && \
48-
cd ~/ffmpeg_sources && \
75+
make install
76+
77+
RUN cd ~/ffmpeg_sources && \
4978
curl -O -L https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && \
50-
tar xjvf ffmpeg-snapshot.tar.bz2 && \
79+
tar -xf ffmpeg-snapshot.tar.bz2 && \
5180
cd ffmpeg && \
5281
PATH=~/bin:$PATH && \
53-
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \
82+
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \
5483
make -j4 && \
5584
make install && \
5685
echo "/root/ffmpeg_build/lib/" >> /etc/ld.so.conf && \
@@ -60,28 +89,10 @@ RUN yum install autoconf automake bzip2 cmake freetype-devel gcc gcc-c++ libtool
6089
ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/root/ffmpeg_build/lib/pkgconfig
6190
ENV LDFLAGS -L/root/ffmpeg_build/lib
6291

63-
RUN mkdir libjpeg-turbo && \
64-
cd libjpeg-turbo && \
65-
export PATH=~/bin:$PATH && \
66-
curl -L https://kent.dl.sourceforge.net/project/libjpeg-turbo/1.5.3/libjpeg-turbo-1.5.3.tar.gz > libjpeg-turbo-1.5.3.tar.gz && \
67-
tar xzvf libjpeg-turbo-1.5.3.tar.gz && \
68-
cd libjpeg-turbo-1.5.3 && \
69-
export CFLAGS="-fPIC" && \
70-
export CXXFLAGS="-fPIC" && \
71-
autoreconf -fiv && \
72-
./configure && \
73-
make && \
74-
make install && \
75-
cd ../../ && \
76-
rm -rf libjpeg-turbo
77-
78-
ENV JPEG_LIBRARY /opt/libjpeg-turbo/lib64/libjpeg.a
79-
ENV JPEG_INCLUDE_DIR /opt/libjpeg-turbo/include
80-
8192
RUN curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/uapi/linux/videodev2.h && \
8293
curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/uapi/linux/v4l2-common.h && \
8394
curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/uapi/linux/v4l2-controls.h && \
8495
curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/linux/compiler.h && \
8596
mv videodev2.h v4l2-common.h v4l2-controls.h compiler.h /usr/include/linux
8697

87-
ENV PATH "$HOME/bin:$PATH"
98+
ENV PATH "$HOME/bin:$PATH"

Diff for: docker/README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,5 @@ The images have following extra software installed:
1010

1111
- Qt 4.8.7
1212
- Cmake 3.9.0
13-
- FFmpeg with libvpx (latest snapshots at the build time)
14-
- libjpeg-turbo 1.5.3
13+
- FFmpeg with libvpx (latest snapshots at the build time) and recent openssl
1514
- Some missing headers included from more recent Linux to be able to enable V4L / V4L2 support in OpenCV

0 commit comments

Comments
 (0)