没有数据从 ffmpeg 写入 stdin 或 stderr [英] No data written to stdin or stderr from ffmpeg
问题描述
我有一个虚拟客户端,可以模拟录像机,在这个客户端上我想模拟视频流;到目前为止,我已经可以从我在代码中创建的位图图像创建视频.
I have a dummy client that is suppose to simulate a video recorder, on this client i want to simulate a video stream; I have gotten so far that i can create a video from bitmap images that i create in code.
虚拟客户端是一个在 Raspberry Pi 3 上运行的 nodejs 应用程序,带有最新版本的 raspian lite.
The dummy client is a nodejs application running on an Raspberry Pi 3 with the latest version of raspian lite.
为了使用我创建的视频,我需要让 ffmpeg 将视频转储到 pipe:1.问题是我需要 -f rawvideo
作为输入参数,否则 ffmpeg 无法理解我的视频,但是当我有该参数集时,ffmpeg 拒绝向 stdio写入任何内容代码>
In order to use the video I have created, I need to get ffmpeg to dump the video to pipe:1. The problem is that I need the -f rawvideo
as a input parameter, else ffmpeg can't understand my video, but when i have that parameter set ffmpeg refuses to write anything to stdio
ffmpeg 正在使用这些参数运行
ffmpeg is running with these parameters
ffmpeg -r 15 -f rawvideo -s 3840x2160 -pixel_format rgba -i pipe:0 -r 15 -vcodec h264 pipe:1
有人可以帮助解决我的问题吗?
Can anybody help with a solution to my problem?
--编辑
也许我应该多解释一下.我正在创建的系统将以某种方式设置,而不是我的流服务器向录像机询问视频流,而是告诉服务器有流的录像机.
Maybe i sould explain a bit more. The system i am creating is to be set up in a way, where instead of my stream server ask the video recorder for a video stream, it will be the recorder that tells the server that there is a stream.
推荐答案
我已经自己解决了问题.(-:
I have have slowed my problem on my own. (-:
我现在有 2 个解决方案.
i now have 2 solutions.
- 是将我的
-f rawvideo
更改为无论如何都对我有用的-f data
. - 我可以在代码中将我的位图编码为 jpeg,并将我的 jpeg 图像通过管道传输到 stdin.这也需要我将 ffmpeg 参数更改为
-r 4 -f mjpeg -i pipe:0 -r 4 -vcodec copy -f mjpeg pipe:1
并且是迄今为止我遇到的最慢的事情完毕.我不能使用 4k 输入
- Is to change my
-f rawvideo
to-f data
that works for me anyways. - I can encode my bitmaps as jpeg in code and pipe my jpeg images to stdin. This also requires me to change the ffmpeg parameters to
-r 4 -f mjpeg -i pipe:0 -r 4 -vcodec copy -f mjpeg pipe:1
and is by far the slowest thing i have ever done. and i can't use a 4k input
感谢@Mulvya 提供帮助.
thanks @Mulvya for trying to help.
@eFox 感谢您编辑我愚蠢的拼写和语法错误
@eFox Thanks for editing my stupid spelling and grammar mistakes
这篇关于没有数据从 ffmpeg 写入 stdin 或 stderr的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!