Search code examples
node.jsherokuffmpegchild-processbuildpack

Adding ffmpeg to heroku buildback nodejs


I've been trying to make a server that can visualize music (This is what I have so far). That's been successful but I want to try and make it work with youtube videos, and I've found a lot of repositories on github for youtube video to audio conversion that make this reasonably doable, but in order to deploy a server on heroku that can host temporary audio files of youtube videos in the format that I want, I'd need to include ffmpeg in a buildpack and I'm not sure how to go about doing that. This is the heroku buildpack for node.js but I don't really understand how it works.

TL;DR: What steps would I need to follow after forking the heroku-buildpack-nodejs repository on github in order to successfully deploy a node.js server to heroku and run this code?

var conversionProcess = child_process.spawn(
  'ffmpeg',
  ['-i', 'some_youtube_audio.mp3', 'some_youtube_audio.webm'],
  {
    cwd: __dirname + '/tmp'
  }
);

The documentation for this function is on the node.js API, by the way.


Solution

  • you should use the multipack https://github.com/ddollar/heroku-buildpack-multi

    then use the node buildpack as well as an ffmpeg buildpack https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest