简体   繁体   中英

ffmpeg Image2pipe command Stuck infinitely while taking image stream from PhantomJS

Let me Explain by my Code what issue i am facing...

This is my js file for using with PhantomJS. It simple tell it to open a page and take screenshots of it and store them in stdout.

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);
});

And this is the cmd command I'm running to receive the captured images in ffmpeg in Windows Command Prompt.

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

This command successfully starts the processes of PhantomJS and ffmpeg. But nothing happens for quite some time, after 15 minutes it gives an error saying:

"Failed to reallocate parser buffer"

thats it. I have referenced this code from this site on which the developer claims that it works https://mindthecode.com/recording-a-website-with-phantomjs-and-ffmpeg/

Please see the attached Image for more explanation. Image of Code

It could be related to stdout the ffmpeg process as it is being stdin through the pipe and after taking continuous image buffer is filled up and gives error.

You can review this from a well organized canvas recording application "puppeteer-recorder" on nodeJS

https://github.com/clipisode/puppeteer-recorder

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM