我想使用Phantomjs录制网站并使用管道和FFMpeg创建实时视频(服务器或流URL)
runner.js代码:
var page = require('webpage').create();
page.viewportSize = { width: 640, height: 480 };
page.open('http://www.goodboydigital.com/pixijs/examples/12-2/', function () {
setInterval(function() {
page.render('/dev/stdout', { format: "png" });
}, 25);
});
Commande Line:
$ phantomjs runner.js | ffmpeg -y -c:v png -f image2pipe -r 24 -i - -c:v libx264 -pix_fmt yuv420p -threads 10 -movflags +faststart -b:v 3500k -bufsize 1024k -f flv "rtmp://rtmp-api.facebook.com:80/rtmp/1734882043502131?ds=1&s_l=1&a=AaYJ7cQfH719X5Kl"