question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running single threaded FFMPEG in a web worker

See original GitHub issue

I know we all cried for a long time to have ffmpeg.wasm without the shared array buffer. It’s now possible by forking the core and using github actions to generate the single threaded artifact.

The problem is this new core does not run in any workers at all, which is CPU blocking and freezes the UI (and sometimes the browser crashes).

I am not an expert with WASM and I am not sure if we can use web workers without having to use the sharedArrayBuffers at all?

Right now when try to use createFfmepg function in a worker (using Comlink), it says document is not defined, a clear sign and ffmpeg.js is not written to work in any thread other than the main one.

If this is possible at all (in the JS files), I would love to work on it too, given the right directions.

Thanks in advance.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:4
  • Comments:17 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
riethmuecommented, Dec 17, 2022

@Chris1234567899 thank you so much for the port! I really struggled with making ffmpeg wasm working in a webworker in angular/ typescript.

1reaction
ImmortalZcommented, May 19, 2022

@nxtexe It would be great if your branch could provide a demo and to show how to use

You were right it was acting a bit strange in the regular browsing environments. I’m not sure why. I tested using react and everything worked fine. But I changed how the package is compiled and added two new scripts for targeting webworkers. Anyway the example can be found here with instructions here. Hope this helps 😄.

@nxtexe

thk,great job! I found my code throw error because use ‘Class’ in work (i’m looking for the reason)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Running FFMPEG with WASM in a Web Worker
We have one worker that imports ffmpeg.js and comlink and it simply exposes the ffmpeg interface, and then we have the webpage that...
Read more >
Running FFMPEG with WASM in a Web Worker - Paul Kinlan
I love FFMPEG.js, it's a neat tool that is compiled with asm.js`and it let's me build JS web apps that can quickly edit...
Read more >
Developers - Running single threaded FFMPEG in a web worker -
Running single threaded FFMPEG in a web worker. ... It's now possible by forking the core and using github actions to generate the...
Read more >
Multithreading in JavaScript with Web Workers - LeanyLabs
Typically, where everything runs in one thread, those computations would block everything else. Not just another Javascript code, but everything - DOM updates, ......
Read more >
Node.js multithreading with worker threads series - Snyk
Node.js provides a single-threaded JavaScript run-time surface that prevents ... If you've used Web Workers in a browser, the worker thread ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found