2022-11-18

How to configure ffmpeg buildpack with nodes.js & subdirectory buildpacks in a heroku project?

In a node.js app hosted on heroku, ffmpeg is used by spawning processes, but is throwing errors anytime an ffmpeg command runs

the error ffmpeg: command not found is thrown both in cli test heroku run ffmpeg as well as production logs

Ive considered:

  • buildpack order
  • buildpack clearing/re-adding/redeploying
  • buildpack required env vars
  • heroku-stack-20 conflicts with buildpack#1 somehow ?

Buildpack order:

  1. https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git
  2. https://github.com/heroku/heroku-buildpack-awscli.git
  3. https://github.com/timanovsky/subdir-heroku-buildpack.git
  4. heroku/nodejs

Buildpack configs - from watching build logs, even though i havent set ffmpeg path, a default is found.

beginning build logs (completes successfully, runs successfully - minus ffmpeg):

-----> Building on the Heroku-20 stack
-----> Using buildpacks:
       1. https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git
       2. https://github.com/xrisk/heroku-opus.git
       3. https://github.com/heroku/heroku-buildpack-awscli.git
       4. https://github.com/timanovsky/subdir-heroku-buildpack.git
       5. heroku/nodejs
-----> ffmpeg app detected
-----> Installing ffmpeg
       Variable FFMPEG_DOWNLOAD_URL isn't set, using default value
       Downloading https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz
       Unpacking the archive
       Installation successful
-----> heroku-opus app detected
       exporting PATH and LIBRARY_PATH
-----> Building in /tmp/build_51b5ac83/opus
-----> Starting opus compilation
       Downloading opus-1.3.1.tar.gz
       Unpacking opus
       Running configure
       Running make install
-----> AWS CLI app detected
-----> Downloading AWS CLI
-----> Installing AWS CLI
       You can now run: /app/.awscli/bin/aws --version
       aws-cli/2.8.12 Python/3.9.11 Linux/4.4.0-1104-aws exe/x86_64.ubuntu.20 prompt/off
-----> Successfully installed AWS CLI
-----> Subdir buildpack app detected
-----> Subdir buildpack in server
       creating cache: /tmp/codon/tmp/cache
       created tmp dir: /tmp/codon/tmp/cache/subdirBuBFb
       moving working dir: server to /tmp/codon/tmp/cache/subdirBuBFb
       cleaning build dir /tmp/build_51b5ac83
       copying preserved work dir from cache /tmp/codon/tmp/cache/subdirBuBFb to build dir /tmp/build_51b5ac83
       cleaning tmp dir /tmp/codon/tmp/cache/subdirBuBFb
-----> Node.js app detected

Any suggestions to further debug this?

EDIT:

  • Ive determined a new order that at least allows heroku run ffmpeg to return successfully
  • that new order essentially requires the subdirectory buildpack to be invoked before the ffmpeg buildpack, and those two items have to be ordered before the heroku/nodejs buildpack
  • BUT: when an ffmpeg command is run through spawning a process in-app, a slightly different error is thrown /bin/sh: 1: ffmpeg: not found
  • running cli command heroku run which ffmpeg returns /app/vendor/ffmpeg/ffmpeg


No comments:

Post a Comment