ffmpeg.wasm
ffmpeg.wasm copied to clipboard
Web Worker Support [PATCH]
In the previous version as far as the browser was concerned there was usage of a deprecated package called resolve-url
which was throwing an error document not defined
as outlined in this issue. However as encouraged by the author, resolve-url
was removed in favour of the browser native URL
API. There still arose an issue in src/browser/getCreateFFmpegCore.js
where a script import was attempted by appending a script tag to the <head>
of the HTML page. In a Web Worker context this will be replaced by globalThis.importScripts
; in the main thread context however the behaviour is unchanged.
Please merge, I also want to use FFMPEG.wasm in a webworker.
Alternatively you could clone my fork as a last resort. 😕
Alternatively you could clone my fork as a last resort. confused
Yes, but the easier and cleaner way is when your changes are merged into the master and (I think) then rebased into the singleThreaded branch.
@nxtexe Can you also add the importScripts
changes from here?
Edit: Sorry, I have only seen it now that you already added the importScripts
Hi there,
Has anyone encountered issues calling ffmpeg.run() multiple times?
The first time i call ffmpeg.run() it works, the 2nd time i call ffmpeg.run() in the web worker it throws the following error;
[fferr] Assertion failed: native function 'malloc' called after runtime exit (use NO_EXIT_RUNTIME to keep it alive after main() exits)
ok, i just tested the transcode.worker.html
example in this pull request and didn't experience the above issue.
Must be the way i integrated the single-threaded solution
any plans to merge this one?
Thanks for the PR! This one looks awesome!
Hi there,
Has anyone encountered issues calling ffmpeg.run() multiple times?
The first time i call ffmpeg.run() it works, the 2nd time i call ffmpeg.run() in the web worker it throws the following error;
[fferr] Assertion failed: native function 'malloc' called after runtime exit (use NO_EXIT_RUNTIME to keep it alive after main() exits)
@merri-ment set EXIT_RUNTIME=0
in wasm/build-scripts/build-ffmpeg.sh
before building ffmpeg.wasm-core
Another +1 on this. Please merge as this blocks using single-threaded in a Worker context.