This is a project which aims to implement a H.264 + AAC decoder for use in Javascript for environments which do not have such decoders built-in (looking at you Facepunch).
This hopefully will add support for playing the most common videos you can stumble upon on the Internet in a game called Garry's Mod. Garry's Mod has now for almost 10 years had a experimental branch which has CEF (Chrome Embedded Framework) web engine for interaction between the game and the web. Facepunch decided to compile without proprietary codec support.
I stumbled upon some solutions using Broadway.js or others, but never saw anything with the added audio support and a proper class bindings. So MPEG4Dec was born.
Look into bindings.cpp for the actual bindings, I am not fluent with Javascript, the only thing I knew how to do is compile FFmpeg and expose the decoders via a C++ class, the rest was just trial and error.
- Download FFmpeg and extract it to this folder (where the README is located).
- Run
./ffmpeg_script.sh, this will compile FFmpeg as a static library with only the required components (saving file size) - Setup Emscripten SDK (so that emcmake and emmake exist)
- Run
./build.sh, this will build the finalmpeg4dec.js