Hi,
I am working on one project that require to render HTML5 Animation into video file. I was using PhantomJs to directly pipe the object using /dev/stdout to FFmpeg using image2pipe and I can get it worked. The problem with the latest version of PhantomJs is, it doesn't render all the HTML5 Animation elements. Some elements are missing from the video output.
Is it possible to do the same thing with SlimmerJS? I 've tried to google the issue but I got no luck for finding the best answer.
So, it could be something like:
page.render('/dev/stdout', { format: 'png', quality: '90' });
and the complete command when executing via terminal is something like:
xvfb-run ./slimerjs html5.js | ffmpeg -y -c:v png -f image2pipe -r 25 -t 10 -i - -c:v libx264 -vf "crop=640:360:0:0" -pix_fmt yuv420p -movflags +faststart VIDEO.mp4 2>Test/LOG.log
Here's my complete js file that executed by SlimmerJS:
var webPage = require('webpage');
var page = webPage.create();
page.viewportSize = { width: 640, height: 360 };
page.open("URL_TO_HTML5_ANIMATION", function start(status) {
function waitit(){
var checkComp = page.evaluate(function(){
return compready();
});
if(!checkComp){
setTimeout(waitit, 500);
}else{
page.evaluate(function(){
controls(false);
});
var duration = page.evaluate(function(){
return getduration();
});
var frames = (duration * 25) / 1000;
for (var i = 1; i <= frames; i++) {
page.evaluate(function(){
nextframe();
});
page.render('/dev/stdout', { format: 'png', quality: '90' });
};
slimer.exit();
}
}
waitit();
});
I got empty result with this message comes from FFmpeg:
ffmpeg version N-73632-g39a04eb Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04)
configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libdcadec --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvo-aacenc --enable-libvidstab
libavutil 54. 28.100 / 54. 28.100
libavcodec 56. 47.100 / 56. 47.100
libavformat 56. 40.100 / 56. 40.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 21.100 / 5. 21.100
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100
[image2pipe @ 0x3308ce0] Could not find codec parameters for stream 0 (Video: png, none(pc)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
pipe:: could not find codec parameters
Input #0, image2pipe, from 'pipe:':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: png, none(pc), 25 tbr, 25 tbn, 25 tbc
Output #0, mp4, to '1.mp4':
Output file #0 does not contain any stream
Regards,
M Teguh
bug