Skip to content

Instantly share code, notes, and snippets.

@czivko
Forked from coopermaruyama/vendor-ffmpeg-heroku
Last active January 23, 2023 12:23
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save czivko/4392472 to your computer and use it in GitHub Desktop.
Save czivko/4392472 to your computer and use it in GitHub Desktop.
How to compile ffmpeg with h264 and mp3 encoders enabled for use on heroku.
## 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 git@heroku.com: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/x264
# 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/mp3lame
# 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/libobb
# add files to git and push to the heroku foo app
##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 && make && make install"
#the above didn't work but this did running from the libvorbis-1.3.3 dir so my ogg compile must have been wrong
vulcan build -v -d http://atmos-vulcan.herokuapp.com/output/128cbd68-ddc3-4888-8bdf-f93c1dcb8ea1
## once done download and extract the tar to the vulcan app to vendor/libvorbis
# add files to git and push to the heroku foo app
#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-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' --extra-ldflags='-L/app/vendor/x264/lib -L/app/vendor/mp3lame/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!
@czivko
Copy link
Author

czivko commented May 30, 2013

enabled vorbis ( ogg ) as compression codec in revision 4

@ttseng
Copy link

ttseng commented Nov 21, 2013

any idea how to compile with libvpx?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment