Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Could not find ffmpeg executable" using 'app.asar.unpacked' #26

Closed
HaveAGitGat opened this issue Apr 28, 2019 · 4 comments
Closed

"Could not find ffmpeg executable" using 'app.asar.unpacked' #26

HaveAGitGat opened this issue Apr 28, 2019 · 4 comments

Comments

@HaveAGitGat
Copy link

I'm trying to run this once packaged on Windows (electron packager). The folder containing ffmpeg.exe successfully unpacks. I then use:

const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path.replace('app.asar', 'app.asar.unpacked');

but I get the error

"Could not find ffmpeg executable"

tried ..,"resources\app.asar\node_modules\@ffmpeg-installer\win32-ia32\ffmpeg.exe"

So it seems to be trying to find the file before it allows the path to be modified to include "app.asar.unpacked".

@HaveAGitGat
Copy link
Author

Interestingly, the above works fine on linux. I've used the following as a solution on windows:

var ffmpegPath = (path.join(__dirname, '\\node_modules\\@ffmpeg-installer\\win32-x64\\ffmpeg.exe' )).replace('app.asar', 'app.asar.unpacked')

@kribblo
Copy link
Owner

kribblo commented Apr 28, 2019

Hmm. Yeah, the code is trying to verify that the file exists, actually only because of a requested fallback to NPM 2 by some user: https://github.com/kribblo/node-ffmpeg-installer/blob/master/index.js

Not sure why it would work on one platform and not the other though, seems, as you put it, interesting. :) Maybe the easiest way to fix it for everyone is to also check for the electron paths, seems a common enough use case. As in, adding more else ifs.

@whyboris
Copy link

whyboris commented Jul 7, 2019

I'm on version "@ffmpeg-installer/ffmpeg": "1.0.18",

I'm using the same command:
const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path.replace('app.asar', 'app.asar.unpacked');

It seems to work with my Electron (Windows and Mac definitely, Linux haven't checked recently):
https://github.com/whyboris/Video-Hub-App/blob/master/main-extract.ts#L26

🤷‍♂

@kribblo kribblo closed this as completed Mar 14, 2021
@MetaiR
Copy link

MetaiR commented Dec 15, 2021

I had the same problem with my electron which is built by electronforge, I manage to make it work by use this config for my asar in the package.json
"asar": { "unpack": "*.{node,dll,exe}" }

hope it helps those in need

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants