This page allows running the MP4Box and GPAC applications in web browsers.
The webassembly build is experimental. It tries to uses webcodecs whenever decoding or encoding is involved. If webcodecs can't be used, it falls back to software implementation running in wasm.
Select an exemple and make edits, or type in your own command. Finally press Enter
key or click the Run
button.
Remote DASH and HLS playlists can be used as input, provided that they are hosted with proper CORS configurations.
The console also provides basic shell file system, commands to import media export media files, and support advanced gpac configuration, as described below:
imp [-d] [N]
: imports files or directory -d
to local filesystem file.imp
: imports single file to current dir using its native nameimp NAME
: imports single file as NAME
imp NAME/
: imports one or more files in NAME
using their native nameimp -d
: imports a directory to current dirimp -d NAME
: imports a directory as NAME
exp NAME
: exports given file NAME
IndexedDB is used for persistent storage, mounted at /idbfs
. Typing any command will synchronize the file system.
The variable $(NAME)
can be used to design a file not on Emscripten's file system.
The file will be handled as a stream (not copied). This is the recommended methods for handling large files.
If NAME
is an absolute URL other than file://
scheme:
Otherwise, NAME
designs a file to be picked on the user's file system
NAME
NAME
. If writable stream failure, the file will be stored in memory until final write or canceled.
For output files, the extension will be used to derive the output format, e.g. ($file.ts)
will use MPEG-2 TS.
Use $(file):ext=ts
to override format if desired. This syntax CANNOT work when editing files (MP4Box, dasher context, etc...).
↑
↓
: Use up & down arrows can be used for command history.ls [N]
: list files in N
or in current directory if N
not set or print file N info - use 'ls -l N' for details.cd [NAME]
: changes current working directory, use Emscripten home if NAME
not providedcwd
: prints current working directoryclear
: clears console outputmkdir NAME
: creates directory NAME
rm NAME
: removes file or empty directory NAME
mv N1 N2
: moves file N1
to N2
cp N1 N2
: copies file N1
to N2
(no recursive copy support)show NAME
: shows content of file NAME
edit NAME
: edits content of file NAME
, use save
to save and close, close
to discard and closeworker
: toggles worker mode on or off (off)threads
: views number of pre-allocated workersstack
: prints available size in stackclearh [N]
: clears command history. If N
is set, only keeps last N
items, otherwise clears everythingfetch
: toggles fetch support in libgpacbsize
: sets block size used to read from local disk (default 10000)eval
: evaluates JS codeThe default behaviour for gpac app is to run on the browser/worker main loop in non-blocking mode, running the session at most 100 times before returning control.
This can be configured when calling gpac (see gpac -hx
), for example:
-step=-1
will block the main browser/worker thread (WILL DEADLOCK if some filters use JS promises or other async tools)
-step=0
will use browser defaults for requestAnimationFrame frequency
-step=100
will request callback every 10 ms
-step=100:1000
will request callback every 10 ms, calling at most 1000 times the session
When running without worker, internal threading of filters (e.g. ffmpeg & co) will be disabled if the session runs only on the main thread.
Use -threads=N
with N
> 0 (typically -threads=1
) to enable threading in these filters.