Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webassembly version #63

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Webassembly version #63

wants to merge 7 commits into from

Conversation

jonasof
Copy link

@jonasof jonasof commented May 2, 2017

Resolve #43.

Depends pull request #55, currently open.

I suggest merging this at new branch like "webassembly". Some things in demo are not working well like loading message and there is too repeating .wasm parses.

Demo available at: https://jonasof.github.io/videoconverter.js-wasm-demo/

@@ -39,11 +39,11 @@ rm *.bc
cp lib/libz.a libz.bc
cp ../ffmpeg/ffmpeg ffmpeg.bc

emcc -s OUTLINING_LIMIT=100000 -v -s TOTAL_MEMORY=33554432 -O2 ffmpeg.bc -o ../ffmpeg.js --pre-js ../ffmpeg_pre.js --post-js ../ffmpeg_post.js
emcc -v -s TOTAL_MEMORY=33554432 -Os ffmpeg.bc -o ../ffmpeg.js --pre-js ../ffmpeg_pre.js --post-js ../ffmpeg_post.js -s WASM=1 -s "BINARYEN_METHOD='native-wasm'" -s ALLOW_MEMORY_GROWTH=1
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat, that's a simple change to get wasm working

@bgrins
Copy link
Owner

bgrins commented May 3, 2017

I suggest merging this at new branch like "webassembly". Some things in demo are not working well like loading message and there is too repeating .wasm parses.

Do you have any ideas on how to improve these things?

@davidturissini
Copy link

davidturissini commented Dec 18, 2018

@bgrins @jonasof I played around with this PR recently, and I've solved the multiple .wasm download issue. The key here is to download and compile the WASM file outside of ffmpeg_run:

Change the ffmpeg_run function signature to:

function ffmpeg_run(opts, wasmBinary) {

Then update WebAssembly.instantiate (around line 1354) to:

WebAssembly.instantiate(wasmBinary, info).then((function(instance) {
    receiveInstance(instance);
}))

Finally, in the worker that calls ffmpeg_run:

WebAssembly.compileStreaming(fetch(PATH_TO_MY_WASM_FILE))
  .then((wasmBinary) => {
    ffmpeg_run(commands, wasmBinary)
})

I will open a PR against this PR later tonight.

@thijstriemstra
Copy link

I will open a PR against this PR later tonight.

any news?

@fotoflo
Copy link

fotoflo commented Sep 27, 2019

Hello, what's the status of this PR? Is it production ready software? Should it branch into it's own project? Thanks.

@fabyeah
Copy link

fabyeah commented Feb 26, 2020

I'm also wondering about the status of this. Would really love to use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compiling into WebAssembly
7 participants