Open birchb opened 4 years ago
Out of curiosity, I implemented the changes jpangelle suggested on Dec 6, 2018, and I get this error:
Error: InvalidInput: Invalid input, not a video file [error code: 2]
at ChildProcess.eval (webpack-internal:///./node_modules/handbrake-js/lib/Handbrake.js:130:15)
at ChildProcess.emit (events.js:210:5)
at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
Perhaps I can just change my arguments and it will work. If so, could you suggest the correct way?
I have never used Electron before, I don't know where to begin debugging this.. Maybe it's time I learned Electron..
One known issue is that Electron has a different process.argv
structure which causes issues with command-line arguments.. Is that relevant?
Sorry, I hadn't put in the code snippets so the first lines didn't show. That's resolved so you can see the complete code and error statements.
I was able to make it work by altering the path in config.js for electron build:
HandbrakeCLIPath = path.join(__dirname, '..', 'app', 'node_modules', 'handbrake-js', 'bin', 'HandbrakeCLI')
I also had to set asar: false
in the build config. It's a hack but it works.
Hey, just seeing this. Were you able to get it going? @birchb
Addemdum:
Editing lib/config.js
enables handbrake-js to work under a PROD build of electron without interfering with other applications. I'm an amateur, so YMMV.
switch (process.platform) {
case 'darwin':
if (process.env.PROD && process.env.MODE === 'electron') {
HandbrakeCLIPath = path.join(__dirname, '..', 'app', 'node_modules', 'handbrake-js', 'bin', 'HandbrakeCLI')
} else {
HandbrakeCLIPath = path.join(__dirname, '..', 'bin', 'HandbrakeCLI')
}
break
case 'win32':
HandbrakeCLIPath = path.join(__dirname, '..', 'bin', 'HandbrakeCLI.exe')
break
case 'linux':
HandbrakeCLIPath = 'HandBrakeCLI'
break
}
This code, which works in a dev build, throws a path error in a production build:
This is the error:
process.platform = darwin process.arch = x64
I tried some of the edits referenced in an early issue, but they also resulted in various errors. I can try again and document those, if it would help.
Note: I'm using Quasar, and found the suggestion
asar: false
in one of the forums. When I did that, I ended up with a app folder the did include HandbrakeCLI, but the path was still incorrect. Again, I can go back and recreate that if it will help.I will happily pay a beer bounty if you can help me figure this out!