ffmpeg.wasm
ffmpeg.wasm copied to clipboard
Ffmpeg.wasm not working in Chrome extension due to SharedArrayBuffer
Describe the bug I can't seem to be able to use ffmpeg.wasm in a chrome extension anymore.
To Reproduce
I simply used the example from https://github.com/ffmpegwasm/chrome-extension-app and loaded it into
my chrome as an extension, this now throws an Uncaught (in promise) ReferenceError: SharedArrayBuffer is not defined error.
I've also attempted to run ffmpeg.wasm from the sanbox environment of a chrome extension, but it resulted in the
same error.
Expected behavior A working example of ffmpeg.wasm running inside of a chrome extension (preferably locally hosted).
Desktop (please complete the following information):
- OS: Windows 10
- Browser: Chrome & Brave
- Version: Chrome 92.0.4515.107 & Brave 1.27.109
You need to enable Cross Origin Isolation for that : https://web.dev/cross-origin-isolation-guide/
I don't know how to set headers in my local environnement, my workaround is to launch Chrome with this command :
--enable-features=SharedArrayBuffer
Check this link to know how to launch Chrome with a command : https://www.chromium.org/developers/how-tos/run-chromium-with-flags
If you upload your website, you will need to set the headers according to the tutorial above, but I don't know how to do it for chrome extensions.
Hello, I want to ask about the progress for single-thread
Here is the latest update for the single-thread version: https://github.com/ffmpegwasm/ffmpeg.wasm/issues/137#issuecomment-890510355
You need to enable Cross Origin Isolation for that : https://web.dev/cross-origin-isolation-guide/
I don't know how to set headers in my local environnement, my workaround is to launch Chrome with this command :
--enable-features=SharedArrayBufferCheck this link to know how to launch Chrome with a command : https://www.chromium.org/developers/how-tos/run-chromium-with-flags
If you upload your website, you will need to set the headers according to the tutorial above, but I don't know how to do it for chrome extensions.
This works fine for a website, but it does not resolve the issue with the chrome extension as far as I can tell.
I went through the process of implementing FFmpeg.wasm in an extension... There are a few caveats, but it is possible.
An example extension with a possible implementation on Manifest V2 (both on Chrome and Firefox): https://github.com/brunoluiz/gifsane-extension Post explaining some of the implementation details: https://brunoluiz.net/blog/2022/jan/gif-sane-playback-control-ffmpegwasm/