问题描述
我正在使用 OpenCV VideoCapture 捕获视频帧.捕获工作正常,因为我可以使用这样的帧:
I am capturing video frames with OpenCV VideoCapture. The capturing works fine as I am able to use the frames like this:
我还想通过网络发送流,这就是我卡住的地方.不知何故,我在 appsrc 管道部分失败了.我想将流编码为 jpeg 并将其发送到 vie udp.这是我得到的:
I would also like to send the stream over the network and here is where I am stuck. Somehow I am failing in the appsrc pipeline part. I want to encode the stream to jpeg and send it vie udp. This is what I got:
看起来上面的行没有做任何事情.writer <<frame
不做任何事情.此外,此 gstreamer 命令不显示任何内容:
Looks like the above line does not do anything. The writer << frame
does not do anything. Also this gstreamer command does not display anything:
我不知道我在 writer.open
部分失败的地方.如果我像下面这样运行 gstreamer 命令,它们就会工作:
I dont know where am I failing in the writer.open
part. If I run the gstreamer commands like this bellow they work:
推荐答案
在使用 OpenCV 的 Gstreamer API 之前,我们需要一个使用 Gstreamer 命令行工具的工作管道.
Before using OpenCV's Gstreamer API, we need a working pipeline using the Gstreamer command line tool.
发送方: OP 使用 JPEG 编码,因此此管道将使用相同的编码.
Sender: The OP is using JPEG encoding, so this pipeline will be using the same encoding.
Receiver:rtpjpegdepay
的接收器caps
需要匹配rtpjpegpay的src
caps
发送方管道.
Receiver: The sink caps
for rtpjpegdepay
need to match the src caps
of the rtpjpegpay
of sender pipeline.
现在我们有用于发送方和接收方的工作管道,我们可以将它们移植到 OpenCV.
Now that we have working pipelines for sender and receiver, we can port them to OpenCV.
发件人:
接收方:
这篇关于如何使用 VideoWriter 从 OpenCV 打开 GStreamer 管道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!