Learn how to run FFmpeg directly in the browser using WebAssembly. This guide covers setup, performance tips, and practical examples for video and audio processing without server-side dependencies.
ffmpeg / Main options ffmpeg.orgffmpeg has been compiled to web assembley via emscripten a number of times typically it will run in a worker thread since by its nature it is very computationally heavy and will tie up the main thread
emscripten : Module object emscripten.org
there are two variants, both are
ffmpeg version 2.2.1 Copyright (c) 2000-2014 the FFmpeg developers
ffmpeg.js -- https://github.com/bgrins/videoconverter.js/blob/master/build/ffmpeg.js 22.5 MB
ffmpeg-all-codecs.js -- https://github.com/bgrins/videoconverter.js/blob/master/build/ffmpeg-all-codecs.js 26.3 MB
the files themselves are available from ( right click save as )
ffmpeg.js -- https://raw.githubusercontent.combgrins/videoconverter.js/master/build/ffmpeg.js
ffmpeg-all-codecs.js -- https://raw.githubusercontent.com/bgrins/videoconverter.js/master/build/ffmpeg-all-codecs.js
in my testing the all-codecs version is about 4 times slower
they are just javascript's, so you can use them by incuding a single, albeit quite large, file
it exposes a single function ffmpeg_run
note. there was mention of
muaz-khan / Ffmpeg.js
github.com
it does offer some additional exmaple code, but as far as i can tell its simply a varaiant of ffmpeg.js from videoconverter.js
tl;dr
tl;dr
when working with audio / video its often helpful to determine the mime types of the codecs in use, actually this only works for mp4