我在从特定摄像头检索 rtsp 流时遇到困难,因为摄像头提供的 rtp 有效负载类型是 35(未分配)并且该摄像头接受的有效负载类型rtph264德佩插件的范围是[96-127]。结果是 gstreamer 显示如下错误:
<udpsrc0> error: Internal data flow error.
<udpsrc0> error: streaming task paused, reason not-linked (-1)
我测试过的其他相机也能正常工作,因为它们定义了良好的有效负载类型。
FFmpeg、MPlayer 和其他工具播放流,尽管它们可能会显示未知类型的警告,例如在 Mplayer 中:
rtsp_session: unsupported RTSP server. Server type is 'unknown'
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);
它覆盖了rtph264德佩插件的接收器垫帽限制较少,现在它接受任何有效负载类型(以及任何时钟速率),只要它是rtp并且有H.264编码。
我认为 gst-launch 不可能做到这一点。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)