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

Using on Linux #8

Open
erikelisath opened this issue Feb 22, 2017 · 8 comments
Open

Using on Linux #8

erikelisath opened this issue Feb 22, 2017 · 8 comments

Comments

@erikelisath
Copy link

hey,
I try to use the player on my linux computer, but it fails. So I used this instruction, but its incomplete and I tried to rebuild the app. After reinstalling some dependencies i run this app and it works better than previously.

When I play a track (by clicking on a track name or the play-icon), I get this error from JavaScript:

Uncaught Exception:
Error: spawn /home/kasperkopf/.config/Electron/ffmpeg/ffplay ENOENT
    at exports._errnoException (util.js:1026:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
    at onErrorNT (internal/child_process.js:359:16)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

I think there is an issue with the ffmpeg path, because I have a system installation of ffmpeg (should find in my $PATH). I tried to read the code of this app to find this path, but i cant find the line where ffmpeg will be used for playing, except metadata/editor.js.

Can someone help me or try to fix this issue?

@mashaal
Copy link
Owner

mashaal commented Feb 22, 2017

Hey Kasperkopf, I recently switched from Aurora.js to FFPLAY to handle the playback of files (much better performance) - but it requires downloading the ffmpeg binaries. The error you are receiving is because it cannot find the ffplay binary.

I created a script ffbinaries.js which you can run to automatically download the correct binaries for your OS - I can verify that it is working on MacOSX.

You can try running it at npm run ffmpeg. It can take a couple mins on first run.

Thanks for logging this -- I did heaps of work on the player over the new year, but haven't documented everything yet! 😔

@erikelisath
Copy link
Author

Hey thanx for your fast reply!

I didn't know that the script ffbinaries.js works for any OS. I run the script, but i get a new error:

ffmpeg complete
fs.js:997
  return binding.unlink(pathModule._makeLong(path));
                 ^

Error: EISDIR: illegal operation on a directory, unlink './ffmpeg'
    at Object.fs.unlinkSync (fs.js:997:18)
    at WriteStream.<anonymous> (/home/kasperkopf/destroyer/ffbinaries.js:12:8)
    at emitNone (events.js:91:20)
    at WriteStream.emit (events.js:186:7)
    at fs.js:1872:14
    at /home/kasperkopf/destroyer/node_modules/graceful-fs/graceful-fs.js:43:10
    at FSReqWrap.oncomplete (fs.js:112:15)

Don't know whats happend with unlink, but the directory exist now. I will keep on this!

@erikelisath
Copy link
Author

erikelisath commented Feb 23, 2017

So finaly it works!

If I use your ffbinaries.js its only downloading ffprobe and ffmpeg because there is no ffplay for Linux. See the github page of ffbinaries-node.
My solution is to link my system binary of ffplay to the created directory by ffbinaries.js with
ln -s /usr/bin/ffplay ~/destroyer/ffmpeg/
then change this both lines of index.js

  player = spawn(`./ffmpeg/ffplay`, [file.path, '-nodisp', '-autoexit'], {stdio: 'ignore'})
  ffmpeg.setFfprobePath(`./ffmpeg/ffprobe`)

Now it works on Linux. Maybe I can use ffplay-static instead of linking the binary.

And can you explain what you want to do with fs.unlinkSync('./ffmpeg') ? I uncommented this line, because i get the error from my previous post.

@mashaal
Copy link
Owner

mashaal commented Feb 23, 2017

ahh, i wasn't aware ffplay wasn't available on linux -- or of ffplay-static. I was actually in the process of rewriting the logic behind getting all of these binaries -- not ready to commit yet. I know it's a bit of a mess -- If you have a better solution for grabbing these binaries, please pull request!

Also, you you get a stable build for linux, please pass it on and I can add it to the releases page -- I have gotten a few requests for linux support, and unfortunately I cannot find the time at the moment.

🏇

@erikelisath
Copy link
Author

Okay let me find some time at the weekend and I will find a better solution. Its strange that there is no Linux support for ffplay. Maybe I find a solution to link the binaries, if there already installed, or I will ask out the guys of ffbinaries and ffplay-static to add Linux support.

btw I have an autoplay/next play issue. will keep this in mind!

@mashaal
Copy link
Owner

mashaal commented Feb 24, 2017

I think there is a bug with autoplay in the last commit i did (not in the released build). I have a commit in progress which will hopefully resolve it (assuming its the same issue).

I've been testing the new commit locally, still working out a few kinks.

@erikelisath
Copy link
Author

erikelisath commented Feb 26, 2017

Issue will fixed with #9. Please read my comment why I change some code.

Can you answer some questions for me?

  • Why you use const userData = app.getPath('userData') for getting later the directory of ffmpeg?
  • What are you doing in line 114 of index.js?

@mashaal
Copy link
Owner

mashaal commented Feb 27, 2017

I was having issues getting the ffmpeg path to resolve in production builds (in macOSX), specifically relative paths, UserData gives a absolute path.

That line in the index.js is copying the ffmpeg binaries to the userdata directory, which is where the app looks for playback. I had it set to only copy on the first instance of the app launching, from then on it should skip as the binaries should already be in place.

I will have a look at your PR to see if it keeps macOSX functionality intact.

Thanks again, getting motivated to fix these fiddly bits. 🚤

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

2 participants