I'm looking to do some in-browser video work using good-ol' FFmpeg
and Rust. Simple examples, where the caller is interacting with the ffmpeg command-line abound. More complex examples are harder to find. In my case I wish to extract, process and rotate discrete frames.
Clipchamp makes impressive use of WASM and FFmpeg
, however the downloaded WASM file (there's only one) will not reveal itself to wasm-nm
nor wasm-decompile
, both complaining about the same opcode:
Unknown opcode 253
unexpected opcode: 0xfd 0x0
Has anyone wisdom to share on how I can (1) introspect the WASM module in use or (2) more generally advise on how I can (using WASM and Rust, most likely) work with video files?
The WASM module uses SIMD instructions (prefixed with 0xfd
, and also known as vector instructions), which were merged into the spec just last month. The latest release of wasm-decompile
therefore doesn't have these enabled by default yet, but will in the next release. Meanwhile, you can enable them manually with the --enable-simd
command line option. This invocation works for me with the latest release:
./wasm-decompile --enable-simd ffmpeg_wasm_simd_c8f3841de02a8803b5e2618ed47cb70f.wasm
I also looked into wasm-nm
, since that would be much more convenient for your use case. Unfortunately it hasn't been updated in four years. It's just a thin wrapper around parity-wasm
however, so I tried updating that to the latest version, including support for SIMD and other yet to be standardized instruction sets. This compiled fine, but unfortunately still complained about unknown opcodes. And after addressing that it errored due to an unexpected EOF. So I fear this library has more fundamental issues that needs to be resolved.