How to install ffmpeg for a django app on heroku?

2019-06-05 20:42发布

问题:

I'd like to use ffmpeg to extract a frame from a video to use it as a poster. This is my first time deploying an app, let alone on heroku, so I'm not sure how to install ffmpeg on the server.

I've found this build of ffmpeg with instructions to 'vendor' it into my app, and then adjust my app's configuration settings / path. What does it mean to vendor something? I have a feeling it's a rails thing, because I can't seem to find an explanation by googling.

Also, what would be the django equivalent of the instructions to run heroku config:set PATH=bin:vendor/ffmpeg/bin:<...> -a yourapp and heroku config:set LD_LIBRARY_PATH=vendor/ffmpeg/lib:/usr/local/lib -a yourapp?

回答1:

You might want to swap out the build pack for this one:

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

The build pack is what takes your source code and builds what gets deployed to your Heroku dynos. This build pack explicitly includes ffmpeg with your app when it's built.



回答2:

I have searched it for 2 day, tried everything what other users said. Then i found simple way. Just go heroku app settings. Then click add buildpack. After that popups small toolbar. Add this url:

https://github.com/kontentcore/heroku-buildpack-ffmpeg

press save changes. Then deploy your app again. You have done :)