Skip to content

FFmpeg UMD not loading in browser — exports is not defined and FFmpeg stays undefined (photo compression works, video fails) #909

@steventauriello

Description

@steventauriello

IM SO FREAKING CLOSE!!!! I’m building a browser-based video & photo compression tool (VidShrink).
Photo compression via ffmpeg.wasm + @ffmpeg/util works perfectly, but the FFmpeg UMD never fully initializes for video — I keep getting:
Uncaught ReferenceError: exports is not defined
FFmpeg UMD loaded: false
FFmpeg Util present: false
FFmpeg still missing after wait
{ FFmpeg: undefined, FFmpegWASM: Module, FFmpegUtil: undefined }
Even though photo compression succeeds.

Environment

Running locally on localhost:3000

No bundler — pure <script> tags in index.html

Using CDNs:

<script src="https://cdnjs.cloudflare.com/ajax/libs/ffmpeg/0.12.15/umd/ffmpeg.min.js"></script> <script src="https://unpkg.com/@ffmpeg/[email protected]/dist/umd/index.js"></script> <script> window.__FFMPEG_CORE_PATH = "https://cdn.jsdelivr.net/npm/@ffmpeg/[email protected]/dist/umd/ffmpeg-core.js"; </script> <script defer src="/app.js"></script>

Chrome 129 on Windows 11

What works
✅ Photo compression via FFmpeg WASM runs and produces output correctly.

What fails
❌ FFmpeg UMD never sets window.FFmpeg → video compression errors:
Error: FFmpeg UMD script not ready. Check index.html load order (no defer on UMD).

What I’ve tried (Everything under the sun)

Different CDNs (cdnjs, unpkg, jsDelivr)

Local hosting of /assets/ffmpeg/*.js

Adding shim to alias window.FFmpegWASM → window.FFmpeg

Hard refresh / clearing cache

Could you please confirm what the correct UMD URLs and load order should be for a non-bundled browser setup in 2025?
Or if UMD builds have moved / changed names?

Thanks for keeping this project alive — it’s awesome work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions