Menu

Running ffmpeg, Whisper and background removal in the browser: lessons learned
📰

Running ffmpeg, Whisper and background removal in the browser: lessons learned

DEV Community: javascript·Denny Kot·14 days ago
#KlPlli1E
#devtojavascript#devto#dev#ffmpeg#wasm
Reading 0:00
15s threshold

I ship a few "server-class" engines in plain static web pages: ffmpeg.wasm for video, Whisper for transcription, an ONNX segmentation model for background removal, and Tesseract for OCR. No backend at all. They all work, but each one taught me something. Here are the practical lessons.

1. Never load the engine with the page

A 30 MB WASM binary in the critical path will ruin your Largest Contentful Paint and your search rankings. The page should be fully usable (dropzone, options, explanation) before any engine code arrives.

The pattern I use:

// Import only when needed... async function getFFmpeg () { const { FFmpeg } = await import ( " @ffmpeg/ffmpeg " ); const ff = new FFmpeg (); await ff . load ({ coreURL , wasmURL }); return ff ; }

// ...but warm the cache once the page is idle window . addEventListener ( " load " , () => { const conn = ( navigator as any ). connection ; if ( conn ?.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.