![]() This is because we feed a lot more images to ffmpeg. This might take a while, but eventually you will end up with a file dragon.mp4 that's a lot smoother than our first attempt. Instead, let's add a pipe to it and feed that juicy image data to ffmpeg instead, who can devour it much better than we can: $ phantomjs runner.js | ffmpeg -y -c:v png -f image2pipe -r 25 -t 10 -i -c:v libx264 -pix_fmt yuv420p -movflags +faststart dragon.mp4 ![]() Now, when we run the runner again, the CLI will throw raw image data at us, so don't! :) We have removed the timeout as we don't need it anymore and we took out the frame counting code as we will tell ffmpeg how long to record for. They have a example on how to do this over here, so let's strip it down to what we need and save it as runner.js var page = require("webpage").create() From the topĬapturing a webpage as an image with PhantomJS is easy stuff. With these two tools installed we are ready to create a video. FFMPegįFMPeg is our all purpose video and audio toolbox to record, convert and stream on the command line. We will use it to generate screenshots of a site. ![]() In case you've been hiding, PhantomJS is a headless scriptable webkit browser with a Javascript API. Here it is, a Pixi dragon The ingredients PhantomJS For this short demo I decided we should go with one of the fun examples on Pixi.JS as they're interesting to capture. What I wanted was to record 10 seconds of video from a random website and output it as a. When I realised you could easily generate screenshots from a site with PhantomJS I just needed to know if I could take it one step further, and record a video. ![]()
0 Comments
Leave a Reply. |