BayLife
BayLife

Reputation: 339

ffmpeg.exe not found inside project directory

I´m currently working on my first electron / react app, which makes use of ffmpeg. I do have a problem to link the .exe file correctly.

The prolem I´m facing is that I ffmpeg.exe is not found when trying to link it with a relative path inside my project directory. When using an absolute path it does work.

The exe files are in the sub-folder of the current directroy.

It does work when I´m using such path:

'C:\\Users\\xxx\\Documents\\development\\ytDownloader\\app\\utils\\ffmpeg\\ffprobe.exe'

But when trying it like this .setFfmpegPath('.\\ffmpeg\\ffmpeg.exe')

or

'./ffmpeg/ffmpeg.exe'

it does not working.

Additionally I would really like to avoid using \\ in my project.

Does someone have an Idea what I´m doing wrong here?

I get this error message:

Error: spawn .\ffmpeg\ffmpeg.exe ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:229)
    at onErrorNT (internal/child_process.js:406)
    at process._tickCallback (internal/process/next_tick.js:63)

Upvotes: 0

Views: 1580

Answers (1)

mahlatse
mahlatse

Reputation: 1307

I have recently started learning nodejs as well, could you try the following maybe ...using the path module

    var fs = require('fs'); 
var path = require('path'); 
var ffmpegPath = path.join(__dirname, '..', 'ffmpeg', 'ffmpeg.exe'); 

Then the ffmpegPath variable will give you access to the path you want,

Or try using

.setFfmpegPath('../ffmpeg/ffmpeg.exe'). 

Where the .. represents the current directory

Upvotes: 1

Related Questions