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

Investigate use of ffmpeg #114

Open
YurySolovyov opened this issue Jul 18, 2016 · 13 comments
Open

Investigate use of ffmpeg #114

YurySolovyov opened this issue Jul 18, 2016 · 13 comments

Comments

@YurySolovyov
Copy link
Collaborator

YurySolovyov commented Jul 18, 2016

Experiments show that it is possible to make a web server that can help us support most of ffmpeg supported audio formats.
This would likely solve most of issues related to lack of native support of different codecs in chrome.
Also ffmpeg provides decent metadata query feature that provides some essential info if available (loweredMetas in museeks terms).

If we choose to integrate it, everything else is implementation details and I'm sure we can reach consensus there.

So far I know that node module for ffmpeg can expose streaming interface for conversion that looks like:

ffmpeg(path).format(outputFormat); // -> ReadableStream

Where path is filepath and outputFormat is extension like wav or mp3.
From what I can tell, we are interested mostly in .wav output format since it is lossless and we won't loose anything from .flac or mp3. Correct me if I'm wrong.

Another thing to consider is binary size: ffmpeg weights something about 30 megs, and I'm not sure how much of this we really need. I tried to reduce file size though build config, but no luck so far. I'm not sure if this is a big issue though.

Thoughts? Questions?

@YurySolovyov
Copy link
Collaborator Author

This may solve #53, #103, #101

@YurySolovyov
Copy link
Collaborator Author

Some status update on this:

  1. it is totally doable
  2. extracting metadata works, but it is more raw then one we get from out current modules, and needs more checks and edge cases support.
  3. actual playback is fine, playing, switching, seeking works
  4. progress rendering is broken, but that's fixable by using AudioContext (Switch from Audio to AudioContext to play music #128) and related infra.

Still todo:

  • investigate how much can we reduce binary size. Needs custom builds of ffmpeg with video stuff dropped. I encourage everyone reading this to try out making custom builds and replacing binaries in my branch to test them.

@martpie
Copy link
Owner

martpie commented Sep 20, 2016

I have a few questions for you @YurySolovyov

  • Is it possible/easy to build our own FFMPEG without useless codecs like videos or images ?
  • If yes, what would be the expected size of the binary ?
  • Would it be possible for FFMPEG to send a stream to a node process (or from a node process, to get a ffpmeg stream) (but not play the sound) ?

@YurySolovyov
Copy link
Collaborator Author

Is it possible/easy to build our own FFMPEG without useless codecs like videos or images ?

And

If yes, what would be the expected size of the binary ?

Yes, but I can't estimate how big the impact would be. Need to investigate.

Would it be possible for FFMPEG to send a string to a node process (but not play the sound) ?

Can you explain a bit? What do you want to achieve?

@martpie
Copy link
Owner

martpie commented Sep 21, 2016

a stream sorry*, not a string

@YurySolovyov
Copy link
Collaborator Author

Yes, this is how my demo build worked.
Playing the stream or not is up to app to decide.

Maybe you can sketch up a design you have in mind? I'm curious.

@YurySolovyov
Copy link
Collaborator Author

Here is the list of possible build options, just for the record

@YurySolovyov
Copy link
Collaborator Author

@KeitIG

If yes, what would be the expected size of the binary ?

ATM, with all codecs museeks currently supports, file size is ~1.4Mb

@martpie
Copy link
Owner

martpie commented Nov 22, 2016

That's pretty cool

@mainrs
Copy link

mainrs commented Dec 12, 2016

Did you consider to use upx to pack the binary?

@martpie martpie removed the back-end label Feb 17, 2019
@martpie
Copy link
Owner

martpie commented Sep 2, 2019

Electron ships with ffmpg, there might be a way to use this version directly.

https://electronjs.org/docs/development/upgrading-chromium#verify-ffmpeg-support

@YurySolovyov
Copy link
Collaborator Author

There might be an issue where chrome only calls ffmpeg for whitelisted formats, so no matter how capable ffmpeg is, chrome might just not pass it through. This is speculation tho.

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

No branches or pull requests

3 participants