I managed to resolve the problem with reinstalling Emscripten (build from source) and also the build scripts inside ffmpeg.wasm was very useful, and if you are not using Docker see the Dockerfile because you will need to set some environment variables before using the mentioned scripts.
There are two articles that are useful for learning compilation of FFmpeg into WebAssembly: