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

Audio Example Not Running while using FFmpeg #5

Closed
Hrushi20 opened this issue Dec 14, 2023 · 11 comments
Closed

Audio Example Not Running while using FFmpeg #5

Hrushi20 opened this issue Dec 14, 2023 · 11 comments

Comments

@Hrushi20
Copy link

Hrushi20 commented Dec 14, 2023

Screenshot 2023-12-14 at 3 51 32 PM

I'm using Mac M1 hardware. I used the below command to build WasmEdge

$  cmake -DCMAKE_BUILD_TYPE=Release -GNinja -DWASMEDGE_BUILD_AOT_RUNTIME=OFF -DWASMEDGE_PLUGIN_WASI_NN_BACKEND="TensorflowLite" -DWASMEDGE_BUILD_TOOLS=OFF ..

I ran the below commands as well -

$ export WASI_SDK=/opt/wasi-sdk
$ export BINDGEN_EXTRA_CLANG_ARGS="--sysroot=/opt/wasi-sdk/share/wasi-sysroot --target=wasm32-wasi -fvisibility=default"

I'm trying to run the audio model using FFmpeg. I'm trying to compare the results of the current implementation and WasmEdge FFmpeg-Rust crate implementation and also observe the performance gain.

@Hrushi20
Copy link
Author

Screenshot 2023-12-14 at 7 17 35 PM

I get the above issue while compiling with ffmpeg in mediapipe-rs

@yanghaku
Copy link
Contributor

Hello @Hrushi20 , can you show your compile command with cargo?

@Hrushi20
Copy link
Author

Hrushi20 commented Dec 14, 2023

$ cargo run --release --example audio_classification -- ./assets/models/audio_classification/yamnet_audio_classifier_with_metadata.tflite ./assets/testdata/audio/speech_16000_hz_mono.wav

Above is my cargo compile command

@yanghaku
Copy link
Contributor

yanghaku commented Dec 14, 2023

Do you set the environment WASI_SDK and BINDGEN_EXTRA_CLANG_ARGS before run cargo?The function clock is in libwasi-emulated-process-clocks.a.

You should set the feature ffmpeg, (add args for cargo: --features="ffmpeg"). And the build.rs will link with ffmpeg library and libwasi-emulated-process-clocks.a

@Hrushi20
Copy link
Author

Do you set the environment WASI_SDK and BINDGEN_EXTRA_CLANG_ARGS before run cargo?The function clock is in libwasi-emulated-process-clocks.a.

You should set the feature ffmpeg, (add args for cargo: --features="ffmpeg"). And the build.rs will link with ffmpeg library and libwasi-emulated-process-clocks.a

Yes I did set the WASI_SDK and BINDGEN_EXTRA_CLANG_ARGS before running cargo based on the README.

I am not sure about export FFMPEG_DIR. I set it to /usr/local/lib because the prebuilt wasi is not for macos ig.

@Hrushi20
Copy link
Author

Hrushi20 commented Dec 14, 2023

I'm using MacOs M1 (Arm) chip. Are the FFmpeg dependencies for x86 processor?

@yanghaku
Copy link
Contributor

I'm using MacOs M1 (Arm) chip. Are the FFmpeg dependencies for x86 processor?

The FFMPEG_DIR is necessary, And FFmpeg library is wasm32-wasi target (not arm, not x86), you can download from here

And the feature ffmpeg is not enabled by default, you can add the --features="ffmpeg" when built using cargo.

@Hrushi20
Copy link
Author

Hrushi20 commented Dec 14, 2023

Screenshot 2023-12-14 at 8 20 23 PM

I get the same error. I deleted the target folder and built it again. Same error.

@Hrushi20
Copy link
Author

Does FFmpeg and Symphonia gives different results while processing audio? I am not able to run FFmpeg on my system using README, however while processing Audio using WasmEdge Rust FFmpeg SDK, I get different results.

@yanghaku
Copy link
Contributor

  1. The error message library kind `framework` is only supported on Apple targets may be bindgen error when parsing FFmpeg header files to generate rust code in MacOS.
    audio_classification_wasm.zip

  2. The FFmpeg and Symphonia give the same results.

@Hrushi20
Copy link
Author

Hey! I cloned the FFmpeg Wasm Repo, compiled and imported it locally on my machine. It is working as expected.

Also, I verified that FFmpeg and Symphonia gives the same Results 😄.

Thanks for your time.

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

No branches or pull requests

2 participants