fluent-ffmpeg / node-fluent-ffmpeg

A fluent API to FFMPEG (http://www.ffmpeg.org)
MIT License
7.85k stars 874 forks source link

Run ffmpeg in browser javascript client side #1133

Open FabioNevesRezende opened 3 years ago

FabioNevesRezende commented 3 years ago

Is there a way to run the library at client side in the browser? In my program I use ffmpeg to convert a video into streamable m3u8 parts but this is very cpu heavy and could be run on the client browser, if so, how to install it to be available in html <script> tag? thanks in advance

jer-0 commented 3 years ago

There is no way of doing this, the client needs to have ffmpeg installed on there pc. Even if they do, you can't run bash command from the browser.

phiberber commented 3 years ago

There is no way of doing this, the client needs to have ffmpeg installed on there pc. Even if they do, you can't run bash command from the browser.

Web development has evolved a lot recently. You actually CAN run FFmpeg in the browser through WebAssembly. Look at this project: https://github.com/ffmpegwasm/ffmpeg.wasm

Not only that, but you can convert FFmpeg's source to Javascript through https://github.com/emscripten-core/emscripten. You can look at an example of that in https://bgrins.github.io/videoconverter.js/.

These options require the client to download some absurd js files, from 20 to 30MB... If you don't want to do that, you can also use https://github.com/antimatter15/whammy, a JS video encoder based on the browser canvas.

SaadBazaz commented 2 years ago

@phiberber +1 on that. Client-side FFMPEG with this library would be an absolute breakthrough. @Mon0Man from what I understand, ffmpeg is spawned in lib/processor.js, right? So if we'd want to use ffmpeg on the client's browser, we could just refer the local WASM installation of ffmpeg there?

Adam-Burke commented 2 years ago

Bump, is this possible?