You can compile a video encoder in javascript using emscripten. For example, here is the compiled emscripten version of google VP9 libvpx library:
https://bitbucket.org/desmaj/libvpx.js/overview
Unfortunately, this is incredibly slow - on the order of one tenth of the speed of a native library. I believe this is due to the fact that there is a lot of access to memory, and it is incredibly slow in emscripten (see https://bugzilla.mozilla.org/show_bug.cgi?id=771106 ). In addition, coding usually depends on the GPU or SIMD parallelism, which is currently not available in javascript.
I think video encoding is simply not possible in javascript at the moment. The best solution for the W3C would be to add an HTML5 video encoding / decoding API, possibly as part of WebRTC / getUserMedia.
Also see this blog post describing the situation:
https://brendaneich.com/2013/05/today-i-saw-the-future/
Cpncrunch
source share