GStreamer管道以显示RTSP流 [英] GStreamer pipeline to show an RTSP stream
问题描述
我对Gstreamer来说还很陌生.
I am pretty new to Gstreamer.
我需要编写一个视频客户端,该客户端能够使用GStreamer从RTSP源流式传输数据.我将VLC配置为使用RTSP流式传输笔记本电脑上的视频,并且我想创建一个管道来获取该流并进行显示.我尝试使用playbin
,一切正常.关键是我需要微调用于流式传输视频的延迟,但是似乎我无法使用playbin来做到这一点.
I need to write a video client able to stream data from an RTSP source using GStreamer. I configured VLC to stream a video I have on my laptop using RTSP and I want to create a pipeline to get that stream and show it. I tried using playbin
and everything works fine. The point is that I need to fine tune the latency used to stream the video but it seems I cannot do that with playbin.
我尝试了rtspsrc
,因为它可以处理延迟,但是我不知道如何在任何窗口上显示视频.那就是我创建的管道:
I tried rtspsrc
because it allows to work on the latency but I don't know how to show the video on any window. That's the pipeline I created:
gst-launch-1.0 rtspsrc location=rtsp://localhost:8554/test latency=300 ! decodebin ! autovideosink
我收到错误消息流任务暂停,原因未协商(-4)".
I get the error "streaming task paused, reason not-negotiated (-4)".
在深入浏览互联网后,我尝试了不同的管道,但我确实错过了一些东西.如何编写gstreamer管道以显示来自RTSP的视频?
I tried different pipelines after deeply looking on the internet but I definitely miss something. How can I write a gstreamer pipeline to show a video from RTSP?
最终目标是拥有一个至少可以在延迟方面可调的管道,因此我有两种选择:
The final goal is to have a pipeline which can be adjustable at least in terms of latency, so I have two choices:
- 设置playbin元素的延迟(如果可能). (此元素正确显示了视频)
- 使用正确的流水线显示视频,因为rtspsrc允许我设置延迟时间.
我使用的是Xubuntu 16.04,gstreamer-tools-1.0(也使用了0.10),我通过VLC流式传输的视频具有mp4扩展名.
I use Xubuntu 16.04, gstreamer-tools-1.0 (used 0.10 as well) and the video I stream with VLC has mp4 extension.
推荐答案
您可以通过设置正确的属性并使用playbin组件来调整延迟时间:
you can adjust the latency by setting the right property and using playbin component:
gst-launch-1.0 -v playbin uri=rtsp://localhost:8554/test uridecodebin0::source::latency=300
希望您发现这很有用:)
Hope you find this useful :)
这篇关于GStreamer管道以显示RTSP流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!