Skip to content

Commit

Permalink
adds Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
akofman committed Jul 19, 2017
0 parents commit f642561
Show file tree
Hide file tree
Showing 3 changed files with 306 additions and 0 deletions.
255 changes: 255 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,255 @@
FROM python:3.6.1-alpine
MAINTAINER Alexis Kofman <[email protected]>

ENV PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" \
CC="/usr/bin/clang" \
CXX="/usr/bin/clang++" \
SRC="/usr/local" \
OPENCV_VERSION="3.2.0" \
FFMPEG_VERSION="3.3.2" \
FDKAAC_VERSION="0.1.5" \
LAME_VERSION="3.99.5" \
OGG_VERSION="1.3.2" \
OPENCOREAMR_VERSION="0.1.4" \
OPUS_VERSION="1.2" \
THEORA_VERSION="1.1.1" \
VORBIS_VERSION="1.3.5" \
VPX_VERSION="1.6.1" \
X264_VERSION="20170226-2245-stable" \
X265_VERSION="2.3" \
XVID_VERSION="1.3.4" \
FREETYPE_VERSION="2.5.5" \
LIBVIDSTAB_VERSION="1.1.0" \
OGG_SHA256SUM="e19ee34711d7af328cb26287f4137e70630e7261b17cbe3cd41011d73a654692 libogg-1.3.2.tar.gz" \
OPUS_SHA256SUM="77db45a87b51578fbc49555ef1b10926179861d854eb2613207dc79d9ec0a9a9 opus-1.2.tar.gz" \
VORBIS_SHA256SUM="6efbcecdd3e5dfbf090341b485da9d176eb250d893e3eb378c428a2db38301ce libvorbis-1.3.5.tar.gz" \
THEORA_SHA256SUM="40952956c47811928d1e7922cda3bc1f427eb75680c3c37249c91e949054916b libtheora-1.1.1.tar.gz" \
XVID_SHA256SUM="4e9fd62728885855bc5007fe1be58df42e5e274497591fec37249e1052ae316f xvidcore-1.3.4.tar.gz" \
FREETYPE_SHA256SUM="5d03dd76c2171a7601e9ce10551d52d4471cf92cd205948e60289251daddffa8 freetype-2.5.5.tar.gz" \
LIBVIDSTAB_SHA256SUM="14d2a053e56edad4f397be0cb3ef8eb1ec3150404ce99a426c4eb641861dc0bb v1.1.0.tar.gz"

RUN apk update && apk upgrade && \
buildDeps="autoconf \
automake \
bash \
binutils \
bzip2 \
clang \
clang-dev \
cmake \
curl \
coreutils \
g++ \
gcc \
libtool \
linux-headers \
make \
openssl-dev \
tar \
yasm \
zlib-dev" && \
apk add --update ${buildDeps} libgcc libstdc++ ca-certificates libgomp && \
export MAKEFLAGS="-j$(($(grep -c ^processor /proc/cpuinfo) + 1))" && \
#RUN \
## opencore-amr https://sourceforge.net/projects/opencore-amr/
DIR=$(mktemp -d) && cd ${DIR} && \
curl -sL https://downloads.sf.net/project/opencore-amr/opencore-amr/opencore-amr-${OPENCOREAMR_VERSION}.tar.gz | \
tar -zx --strip-components=1 && \
./configure --prefix="${SRC}" --bindir="${SRC}/bin" --enable-shared --datadir=${DIR} && \
make && \
make install && \
rm -rf ${DIR} && \
#RUN \
## x264 http://www.videolan.org/developers/x264.html
DIR=$(mktemp -d) && cd ${DIR} && \
curl -sL https://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-${X264_VERSION}.tar.bz2 | \
tar -jx --strip-components=1 && \
./configure --prefix="${SRC}" --bindir="${SRC}/bin" --enable-pic --enable-shared --disable-cli && \
make && \
make install && \
rm -rf ${DIR} && \
#RUN \
## x265 http://x265.org/
DIR=$(mktemp -d) && cd ${DIR} && \
curl -sL https://download.videolan.org/pub/videolan/x265/x265_${X265_VERSION}.tar.gz | \
tar -zx && \
cd x265_${X265_VERSION}/build/linux && \
./multilib.sh && \
make -C 8bit install && \
rm -rf ${DIR} && \
#RUN \
## libogg https://www.xiph.org/ogg/
DIR=$(mktemp -d) && cd ${DIR} && \
curl -sLO http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz && \
echo ${OGG_SHA256SUM} | sha256sum --check && \
tar -zx --strip-components=1 -f libogg-${OGG_VERSION}.tar.gz && \
./configure --prefix="${SRC}" --bindir="${SRC}/bin" --disable-static --datarootdir=${DIR} && \
make && \
make install && \
rm -rf ${DIR} && \
#RUN \
## libopus https://www.opus-codec.org/
DIR=$(mktemp -d) && cd ${DIR} && \
curl -sLO https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz && \
echo ${OPUS_SHA256SUM} | sha256sum --check && \
tar -zx --strip-components=1 -f opus-${OPUS_VERSION}.tar.gz && \
autoreconf -fiv && \
./configure --prefix="${SRC}" --disable-static --datadir="${DIR}" && \
make && \
make install && \
rm -rf ${DIR} && \
#RUN \
## libvorbis https://xiph.org/vorbis/
DIR=$(mktemp -d) && cd ${DIR} && \
curl -sLO http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERSION}.tar.gz && \
echo ${VORBIS_SHA256SUM} | sha256sum --check && \
tar -zx --strip-components=1 -f libvorbis-${VORBIS_VERSION}.tar.gz && \
./configure --prefix="${SRC}" --with-ogg="${SRC}" --bindir="${SRC}/bin" \
--disable-static --datadir="${DIR}" && \
make && \
make install && \
rm -rf ${DIR} && \
#RUN \
## libtheora http://www.theora.org/
DIR=$(mktemp -d) && cd ${DIR} && \
curl -sLO http://downloads.xiph.org/releases/theora/libtheora-${THEORA_VERSION}.tar.gz && \
echo ${THEORA_SHA256SUM} | sha256sum --check && \
tar -zx --strip-components=1 -f libtheora-${THEORA_VERSION}.tar.gz && \
./configure --prefix="${SRC}" --with-ogg="${SRC}" --bindir="${SRC}/bin" \
--disable-static --datadir="${DIR}" && \
make && \
make install && \
rm -rf ${DIR} && \
#RUN \
## libvpx https://www.webmproject.org/code/
DIR=$(mktemp -d) && cd ${DIR} && \
curl -sL https://codeload.github.com/webmproject/libvpx/tar.gz/v${VPX_VERSION} | \
tar -zx --strip-components=1 && \
./configure --prefix="${SRC}" --enable-vp8 --enable-vp9 --enable-pic --disable-debug --disable-examples --disable-docs --disable-install-bins --enable-shared && \
make && \
make install && \
rm -rf ${DIR} && \
#RUN \
## libmp3lame http://lame.sourceforge.net/
DIR=$(mktemp -d) && cd ${DIR} && \
curl -sL https://downloads.sf.net/project/lame/lame/${LAME_VERSION%.*}/lame-${LAME_VERSION}.tar.gz | \
tar -zx --strip-components=1 && \
./configure --prefix="${SRC}" --bindir="${SRC}/bin" --disable-static --enable-nasm --datarootdir="${DIR}" && \
make && \
make install && \
rm -rf ${DIR} && \
#RUN \
## xvid https://www.xvid.com/
DIR=$(mktemp -d) && cd ${DIR} && \
curl -sLO http://downloads.xvid.org/downloads/xvidcore-${XVID_VERSION}.tar.gz && \
echo ${XVID_SHA256SUM} | sha256sum --check && \
tar -zx -f xvidcore-${XVID_VERSION}.tar.gz && \
cd xvidcore/build/generic && \
./configure --prefix="${SRC}" --bindir="${SRC}/bin" --datadir="${DIR}" --disable-static --enable-shared && \
make && \
make install && \
rm -rf ${DIR} && \
#RUN \
## fdk-aac https://github.com/mstorsjo/fdk-aac
DIR=$(mktemp -d) && cd ${DIR} && \
curl -sL https://github.com/mstorsjo/fdk-aac/archive/v${FDKAAC_VERSION}.tar.gz | \
tar -zx --strip-components=1 && \
autoreconf -fiv && \
./configure --prefix="${SRC}" --disable-static --datadir="${DIR}" && \
make && \
make install && \
make distclean && \
rm -rf ${DIR} && \
#RUN \
## freetype https://www.freetype.org/
DIR=$(mktemp -d) && cd ${DIR} && \
curl -sLO http://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \
echo ${FREETYPE_SHA256SUM} | sha256sum --check && \
tar -zx --strip-components=1 -f freetype-${FREETYPE_VERSION}.tar.gz && \
./configure --disable-static --enable-shared && \
make && \
make install && \
make distclean && \
rm -rf ${DIR} && \
#RUN \
## libvstab https://github.com/georgmartius/vid.stab
DIR=$(mktemp -d) && cd ${DIR} && \
curl -sLO https://github.com/georgmartius/vid.stab/archive/v${LIBVIDSTAB_VERSION}.tar.gz &&\
echo ${LIBVIDSTAB_SHA256SUM} | sha256sum --check && \
tar -zx --strip-components=1 -f v${LIBVIDSTAB_VERSION}.tar.gz && \
cmake . && \
make && \
make install && \
rm -rf ${DIR} && \
#RUN \
## ffmpeg https://ffmpeg.org
DIR=$(mktemp -d) && cd ${DIR} && \
curl -sLO https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz && \
tar -zx --strip-components=1 -f ffmpeg-${FFMPEG_VERSION}.tar.gz && \
./configure \
--bindir="${SRC}/bin" \
--disable-debug \
--disable-doc \
--disable-ffplay \
--disable-static \
--enable-avresample \
--enable-gpl \
--enable-libopencore-amrnb \
--enable-libopencore-amrwb \
--enable-libfdk_aac \
--enable-libfreetype \
--enable-libvidstab \
--enable-libmp3lame \
--enable-libopus \
--enable-libtheora \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 \
--enable-libxvid \
--enable-nonfree \
--enable-openssl \
--enable-postproc \
--enable-shared \
--enable-small \
--enable-version3 \
--extra-cflags="-I${SRC}/include" \
--extra-ldflags="-L${SRC}/lib" \
--extra-libs=-ldl \
--prefix="${SRC}" && \
make && \
make install && \
make distclean && \
hash -r && \
cd tools && \
make qt-faststart && \
cp qt-faststart ${SRC}/bin && \
rm -rf ${DIR} && \
#RUN \
# OpenCV depends on Numpy. It represents images as NumPy arrays, so we need to install NumPy :
pip3 install numpy && \
ldconfig && \
#RUN \
# opencv http://opencv.org
DIR=$(mktemp -d) && cd ${DIR} && \
curl -sLO https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.tar.gz && \
tar xzvf ${OPENCV_VERSION}.tar.gz && \
cd opencv-${OPENCV_VERSION} && \
mkdir build && \
cd build && \
cmake -D BUILD_opencv_python3=ON \
-D CMAKE_BUILD_TYPE=RELEASE \
-D INSTALL_C_EXAMPLES=OFF \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D BUILD_EXAMPLES=OFF .. && \
make && \
make install && \
cp ${DIR}/opencv-${OPENCV_VERSION}/build/lib/python3/cv2.cpython-36m-x86_64-linux-gnu.so /usr/local/lib/python3.6/cv2.so && \
rm -rf ${DIR} && \

# cleanup
cd && \
apk del ${buildDeps} && \
rm -rf /var/cache/apk/* /usr/local/include && \
ffmpeg -buildconf
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

The MIT License (MIT)

Copyright (c) 2017 Alexis Kofman

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Docker Video Processing

[![ffmpeg](https://img.shields.io/badge/alpine-v3.4.6-blue.svg)](https://alpinelinux.org)
[![ffmpeg](https://img.shields.io/badge/python-v3.6.1-blue.svg)](https://www.python.org)
[![ffmpeg](https://img.shields.io/badge/ffmpeg-v3.3.2-blue.svg)](https://ffmpeg.org)
[![ffmpeg](https://img.shields.io/badge/opencv-v3.2.0-blue.svg)](http://opencv.org)

Provides a small Docker image (~100MB) intended for video processing.

It includes:
- [Python](https://www.python.org)
- [FFMPEG](https://ffmpeg.org)
- [OpenCV](http://opencv.org)

FFMPEG and OpenCV are compiled from sources.

## Installation
```
$ docker pull akofman/video-processing:latest
```

Then enjoy what's inside:
```
$ docker run --rm -ti akofman/video-processing:latest ash
```

# License

MIT Licensed. Copyright (c) Alexis Kofman 2017.

0 comments on commit f642561

Please sign in to comment.