Yahweasel / libav.js

This is a compilation of the libraries associated with handling audio and video in ffmpeg—libavformat, libavcodec, libavfilter, libavutil, libswresample, and libswscale—for emscripten, and thus the web.
Other
357 stars 28 forks source link

What is the file size limit? #13

Closed NicolaeV closed 1 year ago

NicolaeV commented 1 year ago

Hello! I've written a little ui for me and friends to make short clips from long game recordings (from nvidia shadowplay for example). I used ffmpeg.wasm for this, but the file size is limited to <2GB, which only fits a 6minute long 720p h.264 encoded file. The 2GB limitation is due to an older version of emscripten.

I am currently trying to determine which version of emscripten was the first to include 4GB file size supprt and then build ffmpeg.wasm from source (which i bet is going to be like pulling teeth) with that version. But if your project supports larger file sizes already, I would really love to use it!!

Yahweasel commented 1 year ago

libav is always compiled using the latest version of emscripten at the time. Its file size limit is whatever emscripten's file size limit is.

That being said, writing the entire file into WebAssembly's file simulation space isn't the right way to use libav.js or ffmpeg.wasm. If you want streaming data, use libav.js's built-in reader/writer devices. If you want random-access data, make your own device or file simulation using emscripten's built-in FS.registerDevice. Emscripten has only RAM-backed file systems, so the right move is usually to use something else to get to actual file data.