Skip to content

Instantly share code, notes, and snippets.

@rowntreerob
Last active December 9, 2015 20:38
Show Gist options
  • Save rowntreerob/4324658 to your computer and use it in GitHub Desktop.
Save rowntreerob/4324658 to your computer and use it in GitHub Desktop.
ffmpeg on heroku in Java using static, precompiled binary ( vulcan NOT REQUIRED ). Include the linux x64 executable in the project and change the app's PATH to include that binary.
//statically linked binary at http://dl.dropbox.com/u/24633983/ffmpeg/index.html <-- get the executable from the tgz here
cd to project dir
mkdir -p vendor/bin
cd vendor/bin
cp ${download}/ffmpeg . <-- copy exec file to the project
chmod 775 ffmpeg
modify java to test ffmpeg execution:
##
List<String> command = new ArrayList<String>();
command.add("ffmpeg");
command.add("-codecs");
ProcessBuilder builder = new ProcessBuilder(command);
Map<String, String> environ = builder.environment();
final Process process = builder.start();
InputStream is = process.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
##
git add .
git commit
git push heroku master
## reset path to append the dir where the executable is
heroku config:set PATH=/app/.jdk/bin:/usr/local/bin:/usr/bin:/bin:/app/vendor/bin
verify there is a worker running and test
logs: will show long list of ffmpeg codecs.....
2012-12-21T19:25:39+00:00 app[web.1]: Dec 21, 2012 7:25:39 PM com.sun.jersey.api.core.ScanningResourceConfig logClasses
2012-12-21T19:25:39+00:00 app[web.1]: INFO: Root resource classes found:
2012-12-21T19:25:39+00:00 app[web.1]: class org.example.resources.FfmpegResource
2012-12-21T19:25:39+00:00 app[web.1]: class org.example.resources.InputResource
2012-12-21T19:25:39+00:00 app[web.1]: class org.example.resources.BlobResource
2012-12-21T19:25:39+00:00 app[web.1]: Dec 21, 2012 7:25:39 PM com.sun.jersey.api.core.ScanningResourceConfig init
2012-12-21T19:25:39+00:00 app[web.1]: INFO: No provider classes found.
2012-12-21T19:25:39+00:00 app[web.1]: Dec 21, 2012 7:25:39 PM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
2012-12-21T19:25:39+00:00 app[web.1]: INFO: Initiating Jersey application, version 'Jersey: 1.9.1 09/14/2011 02:05 PM'
2012-12-21T19:25:39+00:00 app[web.1]: Starting process [ffmpeg]
2012-12-21T19:25:39+00:00 app[web.1]: ENV HEROKU_POSTGRESQL_YELLOW_URL postgres://hpunrogbchwdyg:K6CeorahjsACurAuYpvkPwLFnR@ec2-54-243-230-119.compute-1.amazonaws.com:5432/ddhme7oq3cmt8a
2012-12-21T19:25:39+00:00 app[web.1]: ENV DATABASE_URL postgres://hpunrogbchwdyg:K6CeorahjsACurAuYpvkPwLFnR@ec2-54-243-230-119.compute-1.amazonaws.com:5432/ddhme7oq3cmt8a
2012-12-21T19:25:39+00:00 app[web.1]: ENV SHLVL 1
2012-12-21T19:25:39+00:00 app[web.1]: ENV MAVEN_OPTS -Xmx384m -Xss512k -XX:+UseCompressedOops
2012-12-21T19:25:39+00:00 app[web.1]: ENV XFILESEARCHPATH /usr/dt/app-defaults/%L/Dt
2012-12-21T19:25:39+00:00 app[web.1]: ENV PATH /app/.jdk/bin:/usr/local/bin:/usr/bin:/bin:/app/vendor/bin
2012-12-21T19:25:39+00:00 app[web.1]: ENV PWD /app
2012-12-21T19:25:39+00:00 app[web.1]: ENV JAVA_OPTS -Xmx384m -Xss512k -XX:+UseCompressedOops
2012-12-21T19:25:39+00:00 app[web.1]: ENV HOME /app
2012-12-21T19:25:39+00:00 app[web.1]: ENV PORT 8735
2012-12-21T19:25:39+00:00 app[web.1]: ENV PS1 \[\033[01;34m\]\w\[\033[00m\] \[\033[01;32m\]$ \[\033[00m\]
2012-12-21T19:25:39+00:00 app[web.1]: ENV _ /bin/sh
2012-12-21T19:25:39+00:00 app[web.1]: ENV NLSPATH /usr/dt/lib/nls/msg/%L/%N.cat
2012-12-21T19:25:39+00:00 app[web.1]: ENV LD_LIBRARY_PATH /app/.jdk/jre/lib/amd64/server:/app/.jdk/jre/lib/amd64:/app/.jdk/jre/../lib/amd64
2012-12-21T19:25:39+00:00 app[web.1]: ffmpeg version N-47810-geee8c94 Copyright (c) 2000-2012 the FFmpeg developers
2012-12-21T19:25:39+00:00 app[web.1]: built on Dec 13 2012 09:06:31 with gcc 4.7 (Debian 4.7.2-4)
2012-12-21T19:25:39+00:00 app[web.1]: configuration: --extra-cflags=-I../static/include --extra-ldflags='-L../static/lib -static' --enable-gpl --enable-version3 --enable-static --disable-shared --disable-debug --enable-runtime-cpudetect --disable-x11grab --enable-libmp3lame --enable-libx264 --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libxavs --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --disable-ffserver
2012-12-21T19:25:39+00:00 app[web.1]: libavutil 52. 12.100 / 52. 12.100
2012-12-21T19:25:39+00:00 app[web.1]: libavcodec 54. 79.102 / 54. 79.102
2012-12-21T19:25:39+00:00 app[web.1]: libavformat 54. 49.101 / 54. 49.101
2012-12-21T19:25:39+00:00 app[web.1]: libavdevice 54. 3.102 / 54. 3.102
2012-12-21T19:25:39+00:00 app[web.1]: libavfilter 3. 27.101 / 3. 27.101
2012-12-21T19:25:39+00:00 app[web.1]: libswscale 2. 1.103 / 2. 1.103
2012-12-21T19:25:39+00:00 app[web.1]: libswresample 0. 17.102 / 0. 17.102
2012-12-21T19:25:39+00:00 app[web.1]: libpostproc 52. 2.100 / 52. 2.100
2012-12-21T19:25:39+00:00 app[web.1]: Hyper fast Audio and Video encoder
2012-12-21T19:25:39+00:00 app[web.1]: usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
2012-12-21T19:25:39+00:00 app[web.1]:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment