Skip to content
This repository has been archived by the owner on Apr 5, 2022. It is now read-only.

Commit

Permalink
Docker integration, Gem loading
Browse files Browse the repository at this point in the history
  • Loading branch information
Doug Anarino committed Nov 18, 2014
1 parent e993dfc commit 9dca962
Show file tree
Hide file tree
Showing 119 changed files with 4,391 additions and 5,645 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
@@ -0,0 +1,8 @@
.DS_Store
log/*
tmp/*
doc/*
spec/*
spec_aws/*
.git/*
.bundle*
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -3,3 +3,4 @@ log/*
tmp/*
Gemfile.lock
spec/helpers/media/video/*
.bundle*
162 changes: 162 additions & 0 deletions Dockerfile
@@ -0,0 +1,162 @@
FROM ruby
MAINTAINER Movie Masher <support@moviemasher.com>

ENV HOME /root

# install tools and helpers
RUN apt-get update && apt-get install -y \
apt-utils \
build-essential \
checkinstall \
cmake \
git \
subversion \
wget \
yasm

# install video libs and plugins
RUN apt-get update && apt-get install -y \
libdirac-dev \
libfontconfig-dev \
libfribidi-dev \
libgd-dev \
libvpx-dev \
libxvidcore-dev \
frei0r-plugins-dev

# install audio libs and apps
RUN apt-get update && apt-get install -y \
libmp3lame-dev \
libogg-dev \
libopencore-amrnb-dev \
libopencore-amrwb-dev \
libsamplerate-dev \
libsndfile-dev \
libsox-dev \
libspeex-dev \
libtheora-dev \
libvorbis-dev \
sox \
ecasound

# clean up apt and temporary directories
RUN apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# ffmpeg prefers openjpeg 1.5.x, so we compile it from source - 11/15/2014
WORKDIR /data
RUN \
wget https://downloads.sourceforge.net/project/openjpeg.mirror/1.5.2/openjpeg-1.5.2.tar.gz; \
tar -xzvf openjpeg-1.5.2.tar.gz; \
cd /data/openjpeg-1.5.2; \
cmake .; \
make; \
make install; \
cd /data; \
rm -R /data/openjpeg-1.5.2

# pull, configure, make and install x264
WORKDIR /data
RUN \
git clone git://git.videolan.org/x264.git; \
cd /data/x264; \
./configure --prefix=/usr --enable-shared; \
make; \
make install; \
cd /data; \
rm -R /data/x264

# pull, configure, make and install ffmpeg
WORKDIR /data
RUN \
git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg; \
cd /data/ffmpeg; \
./configure \
--enable-frei0r \
--enable-gpl \
--enable-libfontconfig \
--enable-libfreetype \
--enable-libfribidi \
--enable-libmp3lame \
--enable-libopencore-amrnb \
--enable-libopencore-amrwb \
--enable-libopenjpeg \
--enable-libspeex \
--enable-libtheora \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libxvid \
--enable-postproc \
--enable-pthreads \
--enable-version3 \
--enable-zlib \
--extra-cflags="-I/usr/local/include/openjpeg" \
; \
make; \
make install; \
cd /data; \
rm -R /data/ffmpeg

# needed for binaries to find libraries
RUN ldconfig

# install our production gems
COPY Gemfile /data/
COPY Gemfile.lock /data/
WORKDIR /data
RUN \
bundle config --global frozen 1; \
bundle install --without test development

# copy, make and install wav2png
COPY bin/wav2png/* /data/wav2png/
WORKDIR /data/wav2png
RUN \
make; \
mv wav2png /usr/bin/; \
cd /data; \
rm -R /data/wav2png

# copy everything except what's caught by .dockerignore
COPY . /mnt/moviemasher.rb/
WORKDIR /mnt/moviemasher.rb

# install our entry point, with default command
CMD ["moviemasher"]
ENTRYPOINT ["config/docker/entrypoint.rb"]

# expose all our configurable directories as potential mount points
VOLUME /mnt/queue
VOLUME /mnt/log
VOLUME /mnt/render
VOLUME /mnt/download
VOLUME /mnt/error

# EVERYTHING BELOW CAN BE UNCOMMENTED TO PRODUCE DEV IMAGE
##
## # install redis for aws-sdk
## WORKDIR /data
## RUN \
## wget "http://download.redis.io/releases/redis-2.8.17.tar.gz"; \
## gunzip redis-2.8.17.tar.gz; \
## tar -xvf redis-2.8.17.tar; \
## cd /data/redis-2.8.17; \
## ./configure; \
## make; \
## make install; \
## cd /data; \
## rm -R /data/redis-2.8.17
##
## # install our test gems
## COPY Gemfile /data/
## COPY Gemfile.lock /data/
## RUN \
## bundle config --global frozen 1; \
## bundle install --without production
## WORKDIR /mnt/moviemasher.rb
##
## # add a mount point for angular-moviemasher for modular spec tests
## VOLUME /mnt/angular-moviemasher
##
## # add a mount point for the project itself (masking repo copied above)
## VOLUME /mnt/moviemasher.rb
45 changes: 45 additions & 0 deletions Documentation.md
@@ -0,0 +1,45 @@
![Image](https://github.com/moviemasher/moviemasher.rb/raw/master/README/logo-120x60.png "MovieMasher.com") **[moviemasher.js](https://github.com/moviemasher/moviemasher.js "stands below angular-moviemasher, providing audiovisual playback handling and edit support in a web browser") | [angular-moviemasher](https://github.com/moviemasher/angular-moviemasher "sits between moviemasher.js and moviemasher.rb, providing an editing GUI and simple CMS middleware layer") | [moviemasher.rb](https://github.com/moviemasher/moviemasher.rb "sits behind angular-moviemasher, providing processor intensive video transcoding services through a simple API")**

*Ruby library for mashing up video, images and audio utilizing FFmpeg and Ecasound*
# moviemasher.rb

---

### RDoc Documentation


##### Core Classes/Modules


- MovieMasher
- MovieMasher::Job
- MovieMasher::Input
- MovieMasher::Output
- MovieMasher::Transfer
- MovieMasher::Callback


##### Core Usage


require_relative 'lib/moviemasher.rb'
job = { :inputs => [], :base_source => {}, :outputs => [], :destination => {} }
job[:base_source][:path] = job[:destination][:path] = '~/'
job[:inputs] << { :type => 'video', :source => 'input.mov', :fill => 'crop' }
job[:inputs] << { :type => 'image', :source => 'input.jpg', :length => 2 }
job[:inputs] << { :type => 'audio', :source => 'input.mp3', :offset => 10 }
job[:outputs] << { :type => 'video', :name => 'output.mp4' }
MovieMasher.process job

When inputs use relative URLs like the example above then either the input or the job needs a `base_source` object to resolve them to absolute ones. Likewise, a `destination` object resolves the location of outputs and can be placed either in them or in the job in order to be available to all outputs. We've set them both to our home directory in this case so all files live there.

Inputs are arranged consecutively one after the other - at least the visual ones. Audio inputs will by default start where the last audio or video with audio ends, so if the video input in our example has audio the audio input will start after it, otherwise they will begin at the same time. You can also explicitly play an audio track at any time by specify its `start` value.

In addition to raw media (video, audio and images) it's also possible to output image sequences from video tracks and waveform graphics from audio tracks. In terms of inputs, it's also possible to provide a mash JSON payload like moviemasher.js creates. Within a mash input, visual elements can be composited together just like audio elements can in the job itself.

The visual composition of inputs is controlled by *effect, scaler* and *merger* media, which are all arrangements of FFmpeg *filters*. Only a subset of filters and their parameters are supported at this time, but they include basics like crop, scale, fade and drawtext. That last one relies on *font* media, the last of the modular types.


**To regenerate this documentation `cd` to project directory and execute:**

rdoc --visibility=public -o doc --main='Documentation.md' --fmt=darkfish --markup=tomdoc --tab-width=2 --no-dcov --exclude='/spec' --exclude='/log' --exclude='/Gemfile' --exclude='/tmp' --exclude='/config' --exclude='/index.rb' --exclude='/doc' --exclude='/bin' --exclude='/Rakefile' --exclude='/Docker' --exclude='/README' --exclude='/LICENSE'
31 changes: 15 additions & 16 deletions Gemfile
@@ -1,24 +1,23 @@
source 'https://rubygems.org'
source 'http://gems.github.com'

ruby '2.0.0'

gem 'aws-sdk', '= 1.51.0'
gem 'builder', '= 3.1.0'
gem 'json', '= 1.7.7'
gem 'builder', '= 3.1.4'
gem 'mime-types', '~> 2.3'
gem 'require_all', '= 1.3.2'
gem 'uuid', '= 2.3.7'
gem "multipart-post", "= 2.0.0"
gem "rake", "= 10.3.2"

# for spec tests in /spec
#gem "rack", "= 1.5.2"
#gem "rack-test", "= 0.5.7"
#gem 'rspec', '= 2.14.1'
group :production do
gem 'aws-sdk', '= 1.35.0'
gem 'uuid', '= 2.3.1'
gem 'json', '~> 1.4'
# gem "rake", "= 10.3.2"
end

# for spec tests in /spec_aws - see README there
gem 'redis', "3.0.1"
gem "hiredis", "0.4.5"
gem "httparty", "0.11.0"
gem "sinatra", "1.4.2"
group :test do
# for spec tests in /spec
gem 'clientside_aws', :git => 'https://github.com/perrystreetsoftware/clientside_aws.git'
gem "rack-test", "= 0.5.7"
gem 'rspec', '= 2.14.1'
gem "hiredis", "0.4.5"
gem "rmagick", :github => "gemhome/rmagick"
end

0 comments on commit 9dca962

Please sign in to comment.