简体   繁体   English

ffmpeg Image2pipe命令从PhantomJS获取图像流时无限卡住

[英]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. 这是我的PhantomJS使用的js文件。 It simple tell it to open a page and take screenshots of it and store them in stdout. 简单地告诉它打开一个页面并对其截屏并将其存储在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. 这是我正在运行的cmd命令,用于在Windows命令提示符下的ffmpeg中接收捕获的图像。

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. 此命令成功启动PhantomJS和ffmpeg的进程。 But nothing happens for quite some time, after 15 minutes it gives an error saying: 但是在相当长的时间内没有任何反应,在15分钟后,它给出了一个错误消息:

"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/ 我已经从该站点引用了此代码,开发人员声称此站点可以正常运行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. 这可能与ffmpeg进程的标准输出有关,因为它正在通过管道进行标准输入,并在获取连续图像缓冲区后被填充并产生错误。

You can review this from a well organized canvas recording application "puppeteer-recorder" on nodeJS 您可以在nodeJS上组织良好的画布录制应用程序“ puppeteer-recorder”中查看此内容

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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