ffmpeg.wasm icon indicating copy to clipboard operation
ffmpeg.wasm copied to clipboard

SharedArrayBuffer is not defined error in chrome ver 111

Open streetsoul87 opened this issue 2 years ago • 5 comments

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/[email protected]/dist/ffmpeg.min.js)

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

Expected behavior Not error, working well.

Screenshots image

Desktop (please complete the following information):

  • OS: [e.g. iOS] Ubuntu 20.04
  • Browser [e.g. chrome, safari] chrome
  • Version [e.g. 22] 111

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context [ fileUpload.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); });

streetsoul87 avatar Mar 17 '23 07:03 streetsoul87

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

Shivelight avatar Mar 18 '23 03:03 Shivelight

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

mtsee avatar Jul 14 '23 06:07 mtsee

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

JustinFrost47 avatar Aug 22 '23 12:08 JustinFrost47

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

gabrielstuff avatar Sep 01 '23 14:09 gabrielstuff

@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

vegalou avatar Apr 01 '24 08:04 vegalou