H.264 video encoder in javascript

I want to make a video encoder completely in Javascript. The idea is that the user can specify an existing video (quite simply) or a series of images, and then can encode it in H.264 for publication.

I understand that the content of the encoding is not supported right now, but I was wondering if this is completely possible in Javascript (or Flash-bridge) or not?

Thanks.

+8
javascript html5 flash encoding
source share
2 answers

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/

+3
source share

Video encoding is essentially just a specialized mathematical operation on binary data from one file to get more binary data to put in another file. If you have a way to get data (for example, HTML 5 FileReader ) and out (for example AJAX ) in what you need, this is certainly within the scope of the possibility for the middle part to be in JavaScript.

+1
source share

All Articles