【发布时间】:2017-04-09 05:36:50
【问题描述】:
我正在尝试使用 phantomjs 创建视频流,该 phantomjs 从 url 创建屏幕截图,然后它将帧通过管道传输到 ffmpeg,以便他可以使用它将视频流式传输到 rtmp url。 这是我到目前为止所尝试的:
phantomjs runner.js | ffmpeg -f image2pipe -vcodec png -c:a copy -c:v libx264 -f flv rtmp://localhost/mystream
这是脚本:
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);
});
这是输出:
ffmpeg version 3.0.2 Copyright (c) 2000-2016 the FFmpeg developers
built with Apple LLVM version 7.3.0 (clang-703.0.29)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.0.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --enable-vda
libavutil 55. 17.103 / 55. 17.103
libavcodec 57. 24.102 / 57. 24.102
libavformat 57. 25.100 / 57. 25.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 31.100 / 6. 31.100
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Output #0, flv, to 'rtmp://localhost/mystream':
Output file #0 does not contain any stream
【问题讨论】:
-
真正的问题是什么?你想解决什么问题?
-
@LordNeckbeard 我想从 url 截图创建一个视频,然后将它们发布到 rtmp 服务器。基本上 phantomjs 完成了截屏并将它们渲染到“/dev/stdout”的过程,所以我可以通过 ffmpeg 获取它们。我尝试了上面的命令,它没有工作
-
问问题时一定要解释清楚它是如何不工作的,否则就是重复的。
-
“它不起作用”在 Stack Overflow 上从来都不是一个好的问题描述。我会让错误信息在问题中更加突出。您是否也谷歌了错误消息并查看其他人为解决问题所做的工作? --- 我已经对问题标题提出了建议,请查看。
标签: ffmpeg phantomjs video-streaming rtmp