[FFmpeg-devel] [PATCH 0/2] Add wasi(WebAssembly System Interface) support

Zhao Zhili quinkblack at foxmail.com
Fri Jun 28 07:45:58 EEST 2024


From: Zhao Zhili <zhilizhao at tencent.com>

With wasi-sdk toolchain [1], now you can

./configure --cc=${wasi-sdk}/bin/clang \
	--cxx=${wasi-sdk}/bin/clang++ \
	--ar=${wasi-sdk}/bin/ar \
	--strip=${wasi-sdk}/bin/strip \
	--nm=${wasi-sdk}/bin/llvm-nm \
	--ranlib=${wasi-sdk}/bin/ranlib \
	--extra-cflags="--target=wasm32-wasi -D_WASI_EMULATED_SIGNAL -D_WASI_EMULATED_PROCESS_CLOCKS"
	--extra-libs="-lwasi-emulated-signal -lwasi-emulated-process-clocks"
	--disable-inline-asm \
	--disable-x86asm \
	--disable-network \
	--disable-protocol=fd \
	--disable-protocol=pipe \
	--enable-cross-compile \

After make, you can run examples directly on cmdline with wasi runtime,
for example, wasmtime [2] and wasmer [3]

wasmtime --dir . ./demux_decode ./bbb.mp4 bbb-v bbb-a
wasmer --dir . ./demux_decode ./bbb.mp4 bbb-v bbb-a

Besides trying out wasm, I don't know what else it can be used for.

[1] https://github.com/WebAssembly/wasi-sdk
[2] https://github.com/bytecodealliance/wasmtime
[3] https://github.com/wasmerio/wasmer

Zhao Zhili (2):
  avutil/file_open: Fix build error with wasi
  avformat/file: guard fd_dup by FD_PROTOCOL or PIPE_PROTOCOL

 configure             | 2 ++
 libavformat/file.c    | 2 ++
 libavutil/file_open.c | 2 +-
 3 files changed, 5 insertions(+), 1 deletion(-)

-- 
2.42.0



More information about the ffmpeg-devel mailing list