Created
September 2, 2020 06:31
-
-
Save jeromewu/1cd86ecedd1ef4249557c927dea8dcc0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Module = require('./dist/ffmpeg-core'); | |
Module.onRuntimeInitialized = () => { | |
const ffmpeg = Module.cwrap('proxy_main', 'number', ['number', 'number']); | |
const args = ['ffmpeg', '-hide_banner']; | |
const argsPtr = Module._malloc(args.length * Uint32Array.BYTES_PER_ELEMENT); | |
args.forEach((s, idx) => { | |
const buf = Module._malloc(s.length + 1); | |
Module.writeAsciiToMemory(s, buf); | |
Module.setValue(argsPtr + (Uint32Array.BYTES_PER_ELEMENT * idx), buf, 'i32'); | |
}) | |
ffmpeg(args.length, argsPtr); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment