Gstreamer、rtspsrc和有效负载类型

Gstreamer、rtspsrc和有效负载类型,gstreamer,rtsp,rtp,Gstreamer,Rtsp,Rtp,我在从特定摄像机检索rtsp流时遇到困难,因为摄像机提供的rtp有效负载类型为35(未分配),并且rtph264depay插件接受的有效负载类型在范围内[96-127]。结果是gstreamer显示ann错误,如下所示: <udpsrc0> error: Internal data flow error. <udpsrc0> error: streaming task paused, reason not-linked (-1) gstreamer中有没有办法伪造有效负

我在从特定摄像机检索rtsp流时遇到困难,因为摄像机提供的rtp有效负载类型为35(未分配),并且rtph264depay插件接受的有效负载类型在范围内[96-127]。结果是gstreamer显示ann错误,如下所示:

<udpsrc0> error: Internal data flow error.
<udpsrc0> error: streaming task paused, reason not-linked (-1)
gstreamer中有没有办法伪造有效负载类型、忽略不匹配的属性、强制插件之间的链接或以其他方式创建解决问题的方法

我使用的管道是:

gst-launcg-0.10 rtspsrc location="..." ! rtph264depay ! capsfilter caps="video/x-h264,width=1920,height=1080,framerate=(fraction)25/1" ! h264parse ! matroskamux ! filesink location="test.mkv"

我想出来了,并且开始工作了。在这里发布一个答案,希望它可能会使某人受益。有很多类似的问题,但它们缺乏正确的答案

下面是诀窍:

GstElement* depay = gst_element_factory_make("rtph264depay", "video_demux");
assert(depay);
GstPad* depay_sink = gst_element_get_static_pad(depay, "sink");
GstCaps* depay_sink_caps = gst_caps_new_simple("application/x-rtp",
        "media", G_TYPE_STRING, "video",
        "encoding-name", G_TYPE_STRING, "H264",
        NULL);
gst_pad_use_fixed_caps(depay_sink);
gst_pad_set_caps(depay_sink, depay_sink_caps);
gst_object_unref(depay_sink);
它覆盖了rtph264depay插件的接收器盖,限制更少,现在它接受任何有效负载类型(和任何时钟频率),只要它是rtp并且具有H.264编码


我认为gst的启动不可能实现这一点。

这里记录的
rtspsrc
模块中有
select stream
信号


这是一个回调,您可以在其中检查流,如果返回
true
,gstreamer将
SETUP
PLAY
流,如果返回
false
它将忽略它,这将允许您忽略不支持的流,在我的情况下,我在ONVIF元数据流方面遇到问题,它总是尝试播放,并且没有解析器,我真的希望gstreamer忽略那些不能播放的流,使用它拥有的或者至少有一个标志来切换这种行为。

Nice hack。您可能需要为Gstreamer提交一份bug报告,以防我很快就会接触到该摄像头:)
GstElement* depay = gst_element_factory_make("rtph264depay", "video_demux");
assert(depay);
GstPad* depay_sink = gst_element_get_static_pad(depay, "sink");
GstCaps* depay_sink_caps = gst_caps_new_simple("application/x-rtp",
        "media", G_TYPE_STRING, "video",
        "encoding-name", G_TYPE_STRING, "H264",
        NULL);
gst_pad_use_fixed_caps(depay_sink);
gst_pad_set_caps(depay_sink, depay_sink_caps);
gst_object_unref(depay_sink);