I'm trying to run ffmpeg on Heroku using an Aptfile (for use in a Flask app where I want to be able to perform audio conversions using pydub, which works fine locally.)
# Aptfile
libsndfile1
libsndfile1-dev
ffmpeg
libvpx7
libpulse0
pulseaudio
I've got these buildpacks:
# Output from `heroku buildpacks`
1. heroku-community/apt
2. heroku/python
And I keep getting this error with a simple heroku run 'ffmpeg --version'
:
ffmpeg: error while loading shared libraries: libpulsecommon-15.99.so: cannot open shared object file: No such file or directory
This is on Heroku-22, but I was getting the same error on Heroku-20.
Now I've spent hours on this and I'm still confused as to...
libpulsecommon-15.99.so
even part of?ls $HOME/.apt/usr/lib/x86_64-linux-gnu | grep libpulse
(where $HOME
is /app/
) gives:libpulse-simple.so.0
libpulse-simple.so.0.1.1
libpulse.so.0
libpulse.so.0.24.1
echo $LD_LIBRARY_PATH
returns /app/.heroku/vendor/lib:/app/.heroku/python/lib:/app/.apt/usr/lib/x86_64-linux-gnu:/app/.apt/usr/lib/i386-linux-gnu:/app/.apt/usr/lib:
I'm lost and these are hours of my life I'm not going to get back 🤔😅
I'm also wondering if there's much a point trying to get ffmpeg to work on Heroku this way: with the dependencies listed above (in the Aptfile), I'm already at 487 MB in slug size (out of a 300 MB soft limit, 500 MB hard limit), for a codebase under 1 MB.
Any help welcome. I'll update the question as needed.
What is
libpulsecommon-15.99.so
even part of?
On Ubuntu 22.04, upon which the Heroku 22 stack is based, it is part of the libpulse0
package that you have already included in your Aptfile
. I'm not sure why it isn't being found at runtime.
Instead of installing via Ubuntu packages, you might try a dedicated FFmpeg buildpack. This one looks pretty popular.
Something like this should do it:
heroku buildpacks:remove heroku-community/apt
heroku buildpacks:add --index 1 https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git
git rm Aptfile
git commit