ffmpegwasm / ffmpeg.wasm

FFmpeg for browser, powered by WebAssembly
https://ffmpegwasm.netlify.app
MIT License
14.01k stars 816 forks source link

SharedArrayBuffer is not defined error in chrome ver 111 #484

Open streetsoul87 opened 1 year ago

streetsoul87 commented 1 year ago

Describe the bug SharedArrayBuffer error

To Reproduce Steps to reproduce the behavior: When perform load() function using ffmpeg, error is occured. (//cdn.jsdelivr.net/npm/@ffmpeg/ffmpeg@0.8.3/dist/ffmpeg.min.js)

  1. create html file.
  2. type like below.
  3. call ffmpeg.load on javascript file.
  4. Error!!

Expected behavior Not error, working well.

Screenshots image

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context [ fileUpload.html ] <!DOCTYPE html>

File Uploader

[ fileHandler.js ] const startButton = document.getElementById('encodeButton'); startButton.addEventListener('click', async () => { const inputFile = document.getElementById('inputFile').files[0]; if (!inputFile) { return; }

const { createFFmpeg } = FFmpeg; const ffmpeg = createFFmpeg({ log: true });

// FFmpeg loading console.log("Before ffmpeg.load"); await ffmpeg.load(); console.log("After ffmpeg.load");

alert(inputFile.name); });

Shivelight commented 1 year ago

Read the Browser section https://github.com/ffmpegwasm/ffmpeg.wasm#installation

mtsee commented 1 year ago

Why does this project work without SharedArrayBuffer? https://github.com/bgrins/videoconverter.js

JustinFrost47 commented 1 year ago

I faced this error when trying to multithread with this library if you are trying to do that, make sure you setup a server in backend and see the sample code provided in this repo for reference, take a look at it for solving your problem

https://github.com/ffmpegwasm/ffmpeg.wasm/tree/main/apps/vanilla-app

gabrielstuff commented 1 year ago

You can use https://github.com/gzuidhof/coi-serviceworker which fix the issue for me.

vegalou commented 5 months ago

@gabrielstuff Thanks for the share, coi-serviceworker do help SharedArrayBuffer problem in latest chrome. Old version chrome do support SharedArrayBuffer syntax js, but deprecated.

convert 10/fps mp4 is fast, h265 works also with ffmpeg.wasm,

trying to feed file via websocket, if ffmpeg.wasm could convert RTSP firectly.

RTSP -> websocket -> mp4 -> ffmpeg -> livePlay