-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
David Karchmer
committed
Dec 16, 2015
0 parents
commit b49f4e2
Showing
8 changed files
with
474 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.DS_Store | ||
log/* | ||
tmp/* | ||
doc/* | ||
spec/* | ||
*~ | ||
.git/ | ||
.bundle* | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.DS_Store | ||
log/* | ||
tmp/* | ||
.bundle* | ||
*.jpg | ||
*.mp3 | ||
*.mp4 | ||
*~ | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,221 @@ | ||
FROM ubuntu:trusty | ||
|
||
# https://github.com/ampervue/docker-ffmpeg-moviepy | ||
|
||
MAINTAINER David Karchmer <[email protected]> | ||
|
||
##################################################################### | ||
# | ||
# Image based on Ubuntu:14.04 | ||
# | ||
# with | ||
# - Python 3.5 | ||
# - FFMPEG (built) | ||
# - ImageMagick and other requirements for moviepy | ||
# | ||
# plus a bunch of build/web essentials via wheezy | ||
# including MySQL and Postgres clients: | ||
# https://github.com/docker-library/docs/tree/master/buildpack-deps | ||
# | ||
##################################################################### | ||
|
||
ENV PYTHON_VERSION 3.5.1 | ||
ENV PYTHON_PIP_VERSION 7.1.2 | ||
ENV YASM_VERSION 1.3.0 | ||
ENV NUM_CORES 4 | ||
|
||
ENV MOVIEPY_VERSION 0.2.2 | ||
ENV NUMPY_VERSION 1.10 | ||
ENV PILLOW_VERSION 3.0.0 | ||
ENV SCIPY_VERSION 0.16.1 | ||
|
||
RUN apt-get -qq remove ffmpeg | ||
# remove several traces of python | ||
RUN apt-get purge -y python.* | ||
|
||
# Add the following two dependencies if you want to use --enable-gnutls in FFPMEG: gnutls-bin | ||
RUN echo deb http://archive.ubuntu.com/ubuntu precise universe multiverse >> /etc/apt/sources.list; \ | ||
apt-get update -qq && apt-get install -y --force-yes \ | ||
ant \ | ||
autoconf \ | ||
automake \ | ||
build-essential \ | ||
curl \ | ||
checkinstall \ | ||
cmake \ | ||
default-jdk \ | ||
git \ | ||
g++ \ | ||
imagemagick \ | ||
libass-dev \ | ||
libavcodec-dev \ | ||
libavformat-dev \ | ||
libfaac-dev \ | ||
libjpeg-dev \ | ||
libjasper-dev \ | ||
libgnutls-dev \ | ||
libmp3lame-dev \ | ||
libpq-dev \ | ||
libpng-dev \ | ||
libssl-dev \ | ||
libtheora-dev \ | ||
libtiff4-dev \ | ||
libtool \ | ||
libxine-dev \ | ||
libxvidcore-dev \ | ||
libv4l-dev \ | ||
libvorbis-dev \ | ||
mercurial \ | ||
openssl \ | ||
pkg-config \ | ||
postgresql-client \ | ||
supervisor \ | ||
wget \ | ||
unzip; \ | ||
apt-get clean | ||
|
||
# gpg: key F73C700D: public key "Larry Hastings <[email protected]>" imported | ||
RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 97FC712E4C024BBEA48A61ED3A5CA953F73C700D | ||
|
||
RUN set -x \ | ||
&& mkdir -p /usr/src/python \ | ||
&& curl -SL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \ | ||
&& curl -SL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \ | ||
&& gpg --verify python.tar.xz.asc \ | ||
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ | ||
&& rm python.tar.xz* \ | ||
&& cd /usr/src/python \ | ||
&& ./configure --enable-shared \ | ||
&& make -j$(nproc) \ | ||
&& make install \ | ||
&& ldconfig \ | ||
&& find /usr/local \ | ||
\( -type d -a -name test -o -name tests \) \ | ||
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ | ||
-exec rm -rf '{}' + \ | ||
&& rm -rf /usr/src/python | ||
|
||
# make some useful symlinks that are expected to exist | ||
RUN cd /usr/local/bin \ | ||
&& ln -s easy_install-3.4 easy_install \ | ||
&& ln -s idle3 idle \ | ||
&& ln -s pip3 pip \ | ||
&& ln -s pydoc3 pydoc \ | ||
&& ln -s python3 python \ | ||
&& ln -s python-config3 python-config | ||
|
||
RUN pip3 install --no-cache-dir --upgrade --ignore-installed pip==$PYTHON_PIP_VERSION | ||
|
||
WORKDIR /usr/local/src | ||
|
||
RUN git clone --depth 1 https://github.com/l-smash/l-smash \ | ||
&& git clone --depth 1 git://git.videolan.org/x264.git \ | ||
&& hg clone https://bitbucket.org/multicoreware/x265 \ | ||
&& git clone --depth 1 git://source.ffmpeg.org/ffmpeg \ | ||
&& git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git \ | ||
&& git clone --depth 1 https://chromium.googlesource.com/webm/libvpx \ | ||
&& git clone --depth 1 git://git.opus-codec.org/opus.git \ | ||
&& git clone --depth 1 https://github.com/mulx/aacgain.git \ | ||
&& curl -Os http://www.tortall.net/projects/yasm/releases/yasm-${YASM_VERSION}.tar.gz \ | ||
&& tar xzvf yasm-${YASM_VERSION}.tar.gz | ||
|
||
# Build YASM | ||
# ================================= | ||
WORKDIR /usr/local/src/yasm-${YASM_VERSION} | ||
RUN ./configure \ | ||
&& make -j ${NUM_CORES} \ | ||
&& make install | ||
# ================================= | ||
|
||
|
||
# Build L-SMASH | ||
# ================================= | ||
WORKDIR /usr/local/src/l-smash | ||
RUN ./configure \ | ||
&& make -j ${NUM_CORES} \ | ||
&& make install | ||
# ================================= | ||
|
||
|
||
# Build libx264 | ||
# ================================= | ||
WORKDIR /usr/local/src/x264 | ||
RUN ./configure --enable-static \ | ||
&& make -j ${NUM_CORES} \ | ||
&& make install | ||
# ================================= | ||
|
||
|
||
# Build libx265 | ||
# ================================= | ||
WORKDIR /usr/local/src/x265/build/linux | ||
RUN cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr ../../source \ | ||
&& make -j ${NUM_CORES} \ | ||
&& make install | ||
# ================================= | ||
|
||
# Build libfdk-aac | ||
# ================================= | ||
WORKDIR /usr/local/src/fdk-aac | ||
RUN autoreconf -fiv \ | ||
&& ./configure --disable-shared \ | ||
&& make -j ${NUM_CORES} \ | ||
&& make install | ||
# ================================= | ||
|
||
# Build libvpx | ||
# ================================= | ||
WORKDIR /usr/local/src/libvpx | ||
RUN ./configure --disable-examples \ | ||
&& make -j ${NUM_CORES} \ | ||
&& make install | ||
# ================================= | ||
|
||
# Build libopus | ||
# ================================= | ||
WORKDIR /usr/local/src/opus | ||
RUN ./autogen.sh \ | ||
&& ./configure --disable-shared \ | ||
&& make -j ${NUM_CORES} \ | ||
&& make install | ||
# ================================= | ||
|
||
|
||
# Build ffmpeg. | ||
# ================================= | ||
|
||
WORKDIR /usr/local/src/ffmpeg | ||
RUN ./configure --extra-libs="-ldl" \ | ||
--enable-gpl \ | ||
--enable-libass \ | ||
--enable-libfdk-aac \ | ||
--enable-libfontconfig \ | ||
--enable-libfreetype \ | ||
--enable-libfribidi \ | ||
--enable-libmp3lame \ | ||
--enable-libopus \ | ||
--enable-libtheora \ | ||
--enable-libvorbis \ | ||
--enable-libvpx \ | ||
--enable-libx264 \ | ||
--enable-libx265 \ | ||
--enable-nonfree \ | ||
--enable-openssl \ | ||
&& make -j ${NUM_CORES} \ | ||
&& make install | ||
# ================================= | ||
|
||
|
||
# Remove all tmpfile | ||
# ================================= | ||
WORKDIR /usr/local/ | ||
RUN rm -rf /usr/local/src | ||
# ================================= | ||
|
||
# Install moviepy and related packages | ||
# ==================================== | ||
pip install -U numpy==$NUMPY_VERSION | ||
pip install -U Pillow==$PILLOW_VERSION | ||
pip install -U scipy==$SCIPY_VERSION | ||
pip install -U moviepy==$MOVIEPY_VERSION | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 AmperVue, Inc. | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# docker-ffmpeg-moviepy | ||
|
||
A Docker image running Ubuntu:trusty with latest Python 3.5 and latest FFMPEG (built from source) | ||
Also installs moviepy and necessary packages (numpy, scipy, ImageMagick, etc.) | ||
|
||
### To Build | ||
|
||
~~~~ | ||
docker build -t <imageName> . | ||
~~~~ | ||
|
||
### To pull and run from hub.docker.com | ||
|
||
Docker Hub: https://registry.hub.docker.com/u/dkarchmervue/ffmpeg-moviepy/ | ||
|
||
Source and example: https://github.com/ampervue/ffmpeg-moviepy | ||
|
||
~~~~ | ||
docker pull dkarchmervue/ffmpeg-moviepy | ||
docker run -ti dkarchmervue/ffmpeg-moviepy | ||
~~~~ | ||
|
||
## Example | ||
|
||
As an example, the python script uses FFMPEG to build a mosaic of | ||
four videos | ||
|
||
~~~~ | ||
# Pull image | ||
docker pull dkarchmervue/ffmpeg-moviepy | ||
# Get example files and build new image | ||
git clone https://github.com/ampervue/ffmpeg-moviepy | ||
cd example | ||
docker build -t mosaic . | ||
# Mount current directory on container so that file can be written back to host | ||
# Assuming videos are on current directory | ||
docker run --rm -ti -v ${PWD}:/code mosaic video1.mp4 video2.mp4 video3.mp4 video4.mp4 | ||
ls mosaic.mp4 | ||
# To run with bash | ||
docker run --entrypoint bash -ti thumbnail | ||
~~~~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
FROM dkarchmervue/python34-ffmpeg | ||
|
||
# https://github.com/ampervue/ffmpeg-moviepy | ||
|
||
MAINTAINER David Karchmer <[email protected]> | ||
|
||
# ============================================================================ | ||
# As an example, the python script uses moviepy to build a 2x2 mosaic | ||
# based on four videos | ||
# | ||
# ~~~~ | ||
# # Pull image | ||
# docker pull dkarchmervue/ffmpeg-moviepy | ||
# | ||
# # Get example files and build new image | ||
# git clone https://github.com/ampervue/ffmpeg-moviepy | ||
# cd example | ||
# docker build -t mosaic . | ||
# | ||
# # Mount current directory on container so that file can be written back to host | ||
# # Assuming videos are on current directory | ||
# docker run --rm -ti -v ${PWD}:/code mosaic video1.mp4 video2.mp4 video3.mp4 video4.mp4 | ||
# ls mosaic.mp4 | ||
# ~~~~ | ||
# ============================================================================ | ||
|
||
# Step 1: Install any Python packages | ||
# ---------------------------------------- | ||
|
||
ENV PYTHONUNBUFFERED 1 | ||
RUN mkdir /code | ||
WORKDIR /code | ||
ADD requirements.txt /code/ | ||
RUN pip install -r requirements.txt | ||
|
||
# Step 2: Copy Python script | ||
# ---------------------------------------- | ||
|
||
ADD app /code/app | ||
|
||
# Step 3: Configure entrypoint | ||
# ---------------------------------------- | ||
|
||
CMD ["-h"] | ||
ENTRYPOINT ["/usr/bin/python", "app/script.py"] | ||
|
||
|
||
|
||
|
||
|
Oops, something went wrong.