I have a set of animations which I can make in Canvas (fabric.js) or WebGL (three.js). I need to record them automatically, server-side, through a script and output a video file.
The animations include:
- Pictures
- Videos (with audio)
- Other animations/effects
I have researched a lot during last few months on this.
Results
1. Use PhantomJS + FFMPEG
Run HTML Canvas animations on headless browser(PhantomJS) and record with FFMPEG. Here the issue is PhantomJS supports neither WebGL nor Video element. http://phantomjs.org/supported-web-standards.html
2. Use Websockets to send data back to server using DataURL
Here again, we will need to run the animations on browser (which we can't because we have to do everything on server).
3. Use node-canvas
This is a library by TJ Holowaychuk which allows rendering HTML Canvas on Node.js. But it has its own limitations plus I haven't really explored this field much.
(If someone could shed more light on this library)
If anyone has done it before or can guide me somewhere useful.
All we need to do is use some data to create animations and record it into a video, everything on server side.
node-canvas
seems to be for 2d-contexts. I found thenode-webgl
package but have been unsuccessful to install its dependencies. However as a comment i have to write : if you want to record a webgl context (and use it as a rendering engine) to output videos for yourself, 1-by-1, you can do it server-side withxhr
on a local server. But if you want to output videos to each connected user on the internet, just consider that it asks your serverSSS to have one CPU-GPU couple per visitor. I have been checking google for 'server-side 3D rendering' : there is nothing serious now with 2015 techs. – Fatigued