Forked from czivko/vendor-ffmpeg-x264-mp3lame-heroku
Last active
December 28, 2015 19:49
-
-
Save bruchu/7552598 to your computer and use it in GitHub Desktop.
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
## Get FFMpeg working on heroku by building binaries using vulcan | |
# also added instructions on how to compile with libmp3lame and libx264 | |
gem install vulcan | |
vulcan create foo | |
#clone the app vulcan just created | |
git clone [email protected]:foo | |
git clone --depth 1 git://git.videolan.org/x264 | |
cd x264 | |
vulcan build -v -s . -c "./configure --enable-static --enable-shared --disable-asm --prefix=/app/vendor/x264 && make && make install" | |
## once done download and extract the tar to the vulcan app to vendor | |
# add files to git and push to the heroku foo app | |
## Download the latest source for Lame mp3 and extract to foo and cd to the dir | |
vulcan build -v -s . -c "./configure --enable-shared --disable-asm --prefix=/app/vendor/mp3lame && make && make install" | |
## once done download and extract the tar to the vulcan app to vendor | |
# add files to git and push to the heroku foo app | |
##Download latest ogg source from http://www.xiph.org/downloads/ and extract to foo and cd to the dir | |
vulcan build -v -s . -c "./configure --enable-shared --disable-asm --prefix=/app/vendor/libogg && make && make install" | |
## once done download and extract the tar to the vulcan app to vendor | |
# add files to git and push to the heroku foo app | |
cd vendor | |
tar xzvf /tmp/..tgz | |
git add libogg | |
git commit -m'add libogg' | |
git push | |
##Download latest vorbis source from http://www.xiph.org/downloads/ and extract to foo and cd to the dir | |
vulcan build -v -s . -c "./configure --enable-shared --disable-asm --prefix=/app/vendor/libvorbis --with-ogg-libraries=/app/vendor/libogg/lib --with-ogg-includes=/app/vendor/libogg/include && make && make install" | |
## once done download and extract the tar to the vulcan app to vendor | |
# add files to git and push to the heroku foo app | |
cd faac-1.28 | |
vulcan build -v -s . -c "./configure --enable-shared --disable-asm --prefix=/app/vendor/faac && make && make install" | |
#Now we are finally ready to compile ffmpeg with these dependancies | |
git clone --depth 1 git://source.ffmpeg.org/ffmpeg | |
cd ffmpeg | |
vulcan build -v -s . -c "./configure --enable-shared --enable-libfaac --enable-nonfree --enable-gpl --enable-libx264 --enable-libvorbis --enable-libmp3lame --disable-asm --prefix=/app/vendor/ffmpeg --extra-cflags='-I/app/vendor/x264/include -I/app/vendor/mp3lame/include -I/app/vendor/faac/include -I/app/vendor/libvorbis/include -I/app/vendor/libogg/include' --extra-ldflags='-L/app/vendor/x264/lib -L/app/vendor/mp3lame/lib -L/app/vendor/faac/lib -L/app/vendor/libvorbis/lib -L/app/vendor/libogg/lib' && make && make install" | |
## once done, you'll see something along the lines of: | |
# >> Downloading build artifacts to: /tmp/ffmpeg.tgz | |
# (available at http://foo.herokuapp.com/output/d21f6bb8-6db6-4397-b02e-347806945881) | |
# | |
# Download the .tgz via the link or cd to /tmp then: | |
tar xvf ffmpeg.tgz | |
mkdir /path/to/app/vendor/ffmpeg | |
mv ffmpeg/* /path/to/app/vendor/ffmpeg/ | |
# cd to your app then: | |
heroku config:set PATH=bin:vendor/ffmpeg/bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin -a yourapp | |
#in the above, make sure you are simply appending 'vendor/ffmpeg/bin' to whatever is already set when you run 'heroku config' and look at the currently set value for PATH. overwriting it will break your app. | |
heroku config:set LD_LIBRARY_PATH=vendor/ffmpeg/lib:/usr/local/lib -a yourapp | |
git add . | |
git commit -m "vendor ffmpeg" | |
git push heroku master | |
# enjoy! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks a lot for your gist; it's helping me a lot. I was able to get through all the steps, but when I actually try to convert a video through my heroku app, I get the error "ffmpeg: error while loading shared libraries: libx264.so.140: cannot open shared object file: No such file or directory" I made sure to specify by the LD_LIBRARY_PATH, and when I run "heroku run which ffmpeg", I get "vendor/ffmpeg/bin/ffmpeg"
Do you know how I might fix this?