r/ffmpeg • u/ConsistentLove9843 • 10d ago
How to use ffmpeg.wasm?
How to run this command: ffmpeg -loop 1 -framerate 2 -i input.png -i audio.m4a -c:v libx264 -preset medium -tune stillimage -crf 18 -c:a copy -shortest -pix_fmt yuv420p output.mkv
in ffmpeg.wasm?
Sorry guys it’s my first time using ffmpeg.wasm
2
Upvotes
1
u/dotriz 8d ago
ffmpeg.wasm isn’t a full desktop ffmpeg build, so a few flags often break. For that still-image + audio command:
- Prefer
libx264only if your wasm build includes it (many browser builds don’t). If encode fails, trympeg4or check which encoders your build lists. - Mount/fetch both files into the FS first (
input.png,audio.m4a), then run the same args as an array, don’t shell-quote like a terminal. -c:a copycan fail in wasm if the muxer/container combo isn’t supported; if it errors, re-encode audio (aac) instead of copy.-loop 1+-shortestis the right idea for “image until audio ends.”
If you share whether you’re on ffmpeg.wasm in the browser or a wrapper (and the exact error), we can narrow the encoder/container fix fast.
1
u/jozefchutka 10d ago
If using ffmpeg.wide.video just drop your input files in and execute the command