NUKnightLab / videojam

A new start for Project VideoJAM
Other
4 stars 1 forks source link

More robust method to set ffmpeg path #8

Open JoeGermuska opened 6 years ago

JoeGermuska commented 6 years ago

Because we're bundling ffmpeg binaries with our app, we also need to set the explicit path to those binaries as part of bootstrapping the app.

While we find a repository with example code, that project used browserify instead of webpack to pull project code together. Since we're using webpack, we're subject to issues about how the value of __dirname is handled, as discussed at some length in webpack/webpack#1599 and also explained in the webpack docs

In short, even when handling the config, __dirname will have a different value when the code is executed in the webpacked bundle than it does in the ffmpeg-static code.

We need to understand where (at which filesystem path) in the bundled Electron app the ffmpeg binaries are located, and then come up with a new way to get the path. We could probably adapt the construction method from ffmpeg-static but execute the code with a better idea of __dirname -- possibly with process.getCwd() or possibly with __dirname under more clearly controlled circumstances.

JoeGermuska commented 6 years ago

As a side note, someone I talked to suggested moving the ffmpeg operations out of the "client" (aka "browser") code and situating it in main.js (the Electron bootstrap file) instead. That would get us out of any Webpack-induced confusion, and might be architecturally sound for other reasons.

This webpage shows some example code about how to do that.