Gstreamer,rtspsrc和有效负载类型 [英] Gstreamer, rtspsrc and payload type

查看:562
本文介绍了Gstreamer,rtspsrc和有效负载类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm having difficulties in retrieving rtsp stream from a specific camera, because the rtp payload type the camera is providing is 35 (unassigned) and payload types accepted by the rtph264depay plugin are in range [96-127]. The result is that gstreamer displays ann error like:

<udpsrc0> error: Internal data flow error.
<udpsrc0> error: streaming task paused, reason not-linked (-1)

我测试过的其他相机正在工作,因为它们定义了良好的有效负载类型.

Other cameras that I have tested are working because they define a good payload type.

FFmpeg,MPlayer和其他工具播放流,尽管它们可能会针对未知类型显示警告,例如在Mplayer中:

FFmpeg, MPlayer and other tools play the stream, although they may display a warning for the unknown type, for instance in Mplayer:

rtsp_session: unsupported RTSP server. Server type is 'unknown'

gstreamer中是否有任何方法可以伪造有效负载类型,忽略不匹配的属性,强制在插件之间进行链接或以其他方式解决我的问题?

Is there any way in gstreamer to fake the payload type, ignore the mismatching property, force linking between the plugins or otherwise create a workaroud to my problem?

我正在使用的管道是:

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"

推荐答案

我知道了并使其正常运行.在这里发布答案,希望它可以使某人受益.那里有多个类似的问题,但是它们缺少适当的答案.

I figured it out and got it working. Posting an answer here in hope that it might benefit someone. There are multiple similar questions out there, but they lack proper answers.

以下是窍门:

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 编码.

it overrides the rtph264depay plugin's sink pad caps to be less restrictive, now it accepts any payload type (and any clock-rate) as long as it is rtp and has H.264 encoding.

我认为gst-launch不可能做到这一点.

I don't think this is possible with gst-launch.

这篇关于Gstreamer,rtspsrc和有效负载类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆