Giter Club home page Giter Club logo

heroku-buildpack-python-ffmpeg-lame's Introduction

Heroku buildpack: Python-ffmpeg-lame

This is a Heroku buildpack for Python apps. The only difference from the clean Python buildpack is that this one includes ffmpeg with mp3 support. A pre-built version is simply cloned from this repo, which was built on Heroku.

It uses virtualenv and pip.

Usage

Example usage:

$ ls
gunicorn.py.ini  Procfile  requirements.txt  wsgi.py
$ git init
Initialized empty Git repository in /path/to/app/.git/
$ heroku create --stack cedar --buildpack git://github.com/integricho/heroku-buildpack-python-ffmpeg-lame.git
Creating random-app-name-1234... done, stack is cedar
BUILDPACK_URL=git://github.com/integricho/heroku-buildpack-python-ffmpeg-lame.git
http://random-app-name-1234.herokuapp.com/ | [email protected]:random-app-name-1234.git
Git remote heroku added
$ git add .
$ git commit -m "Initial commit."
[master (root-commit) 16d444a] Initial commit.
 4 files changed, 29 insertions(+)
 create mode 100644 Procfile
 create mode 100644 gunicorn.py.ini
 create mode 100644 requirements.txt
 create mode 100644 wsgi.py
$ git push heroku master
Counting objects: 6, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (6/6), 786 bytes, done.
Total 6 (delta 0), reused 0 (delta 0)
-----> Fetching custom git buildpack... done
-----> Python app detected
-----> Cloning pre-built ffmpeg repository...
-----> Preparing Python interpreter (2.7.2)
-----> Creating Virtualenv (1.8.4)
       Also creating executable in .heroku/venv/bin/python
       Installing distribute...done.
       Installing pip...done.
       Running virtualenv with interpreter /usr/local/bin/python2.7
-----> Installing dependencies using pip (1.1)
       Downloading/unpacking gevent==0.13.8 (from -r requirements.txt (line 2))
         Storing download in cache at /app/tmp/repo.git/.cache/pip_downloads/http%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fg%2Fgevent%2Fgevent-0.13.8.tar.gz
         Running setup.py egg_info for package gevent

       Downloading/unpacking gunicorn==0.14.3 (from -r requirements.txt (line 3))
         Storing download in cache at /app/tmp/repo.git/.cache/pip_downloads/http%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fg%2Fgunicorn%2Fgunicorn-0.14.3.tar.gz
         Running setup.py egg_info for package gunicorn

       Downloading/unpacking greenlet (from gevent==0.13.8->-r requirements.txt (line 2))
         Storing download in cache at /app/tmp/repo.git/.cache/pip_downloads/http%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fg%2Fgreenlet%2Fgreenlet-0.4.0.zip
         Running setup.py egg_info for package greenlet

       Installing collected packages: gevent, gunicorn, greenlet
         Running setup.py install for gevent
           building 'gevent.core' extension
           gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include/python2.7 -c gevent/core.c -o build/temp.linux-x86_64-2.7/gevent/core.o
           gcc -pthread -shared build/temp.linux-x86_64-2.7/gevent/core.o -levent -o build/lib.linux-x86_64-2.7/gevent/core.so
           Linking /tmp/build_3fhn8k1szm2sp/.heroku/venv/build/gevent/build/lib.linux-x86_64-2.7/gevent/core.so to /tmp/build_3fhn8k1szm2sp/.heroku/venv/build/gevent/gevent/core.so

         Running setup.py install for gunicorn

           Installing gunicorn_paster script to /tmp/build_3fhn8k1szm2sp/.heroku/venv/bin
           Installing gunicorn script to /tmp/build_3fhn8k1szm2sp/.heroku/venv/bin
           Installing gunicorn_django script to /tmp/build_3fhn8k1szm2sp/.heroku/venv/bin
         Running setup.py install for greenlet
           building 'greenlet' extension
           gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include/python2.7 -c greenlet.c -o build/temp.linux-x86_64-2.7/greenlet.o
           greenlet.c: In function 'g_switch':
           greenlet.c:543: warning: 'err' may be used uninitialized in this function
           gcc -pthread -shared build/temp.linux-x86_64-2.7/greenlet.o -o build/lib.linux-x86_64-2.7/greenlet.so
           Linking /tmp/build_3fhn8k1szm2sp/.heroku/venv/build/greenlet/build/lib.linux-x86_64-2.7/greenlet.so to /tmp/build_3fhn8k1szm2sp/.heroku/venv/build/greenlet/greenlet.so

       Successfully installed gevent gunicorn greenlet
       Cleaning up...
-----> Discovering process types
       Procfile declares types -> web
-----> Compiled slug size: 79.3MB
-----> Launching... done, v5
       http://random-app-name-1234.herokuapp.com deployed to Heroku

To [email protected]:random-app-name-1234.git
 * [new branch]      master -> master
$ heroku run bash
Running `bash` attached to terminal... up, run.1627
~ $ ffmpeg
ffmpeg version git-2013-03-30-ee53777 Copyright (c) 2000-2013 the FFmpeg developers
  built on Mar 31 2013 13:19:53 with gcc 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
  configuration: --enable-shared --disable-asm --enable-libmp3lame --prefix=/app/vendor/ffmpeg --extra-cflags=-I/app/vendor/lame/include --extra-ldflags=-L/app/vendor/lame/lib
  libavutil      52. 23.100 / 52. 23.100
  libavcodec     55.  2.100 / 55.  2.100
  libavformat    55.  1.100 / 55.  1.100
  libavdevice    55.  0.100 / 55.  0.100
  libavfilter     3. 48.105 /  3. 48.105
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'
~ $ exit

You can also add it to upcoming builds of an existing application:

$ heroku config:add BUILDPACK_URL=git://github.com/integricho/heroku-buildpack-python-ffmpeg-lame.git

The buildpack will detect your app as Python if it has the file requirements.txt in the root. It will detect your app as Python/Django if there is an additional settings.py in a project subdirectory.

It will use virtualenv and pip to install your dependencies, vendoring a copy of the Python runtime into your slug. The bin/, include/ and lib/ directories will be cached between builds to allow for faster pip install time.

Hacking

To use this buildpack, fork it on Github. Push up changes to your fork, then create a test app with --buildpack <your-github-url> and push to it.

To change the vendored virtualenv, unpack the desired version to the src/ folder, and update the virtualenv() function in bin/compile to prepend the virtualenv module directory to the path. The virtualenv release vendors its own versions of pip and setuptools.

heroku-buildpack-python-ffmpeg-lame's People

Contributors

andres-torres-marroquin avatar craigkerstiens avatar dcrosta avatar dpaola2 avatar gulopine avatar kencochrane avatar lstoll avatar n0phx avatar ojno avatar saulshanabrook avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.