[英]Gstreamer RTSP Decoding Frame Timestamps
We are decoding RTSP stream frames using Gstreamer in C++. We need to read the frame NTP timestamps, which we think that resides in RTCP packets.我们在 C++ 中使用 Gstreamer 解码 RTSP stream 帧。我们需要读取帧 NTP 时间戳,我们认为它驻留在 RTCP 数据包中。 After some documentation digging, we found an element called GstRTPBaseDepayload , which has a property called "stats", which has a field "timestamp", explained as the "last seen RTP timestamp".在一些文档挖掘之后,我们发现了一个名为GstRTPBaseDepayload的元素,它有一个名为“stats”的属性,它有一个字段“timestamp”,解释为“最后看到的 RTP 时间戳”。
Our original pipeline:我们原来的管道:
gst-launch-1.0 rtspsrc port-range=5000-5100 location="rtsp://.." latency=300 is-live=true, queue, rtph265depay name=depayer, video/x-h265, stream-format=byte-stream, alignment=au ! h265parse ! video/x-h265 , stream-format=byte-stream, alignment=au ! appsink name=mysink sync=true
I named the depay element as rtph265depay name=dp
, then:我将 depay 元素命名为rtph265depay name=dp
,然后:
depayer_=gst_bin_get_by_name(GST_BIN(pipeline_), "dp");
GstStructure * stat;
g_object_get((GstRTPBaseDepayload*)depayer_,"stats",stat);
GType type = gst_structure_get_field_type(stat,"timestamp");
It gave an error saying that the stat structure does not have a field, in fact, it did not have any fields.它给出了一个错误,说 stat 结构没有字段,事实上,它没有任何字段。 I did not find any example usage of GstRTPBaseDepayload, and the documentation is lacking as always.我没有找到 GstRTPBaseDepayload 的任何示例用法,并且文档一如既往地缺乏。 I would appreciate any guidance regarding the frame timestamps.我将不胜感激有关帧时间戳的任何指导。
Edit:编辑:
I also tried to check if depayer_ has a null value:我还尝试检查 depayer_ 是否具有 null 值:
depayer_=gst_bin_get_by_name(GST_BIN(pipeline_), "dp");
if(depayer_!=nullptr){
GstStructure * stat;
// GstRTPBaseDepayload* depayload;
g_object_get(depayer_,"stats",stat,NULL);
if(gst_structure_has_field(stat,"timestamp")){ //this line causes segfault
guint timestamp;
gst_structure_get_uint(stat,"timestamp",×tamp);
}
}
Neither depayer nor stat object is null, however gst_structure_has_field(stat,"timestamp")
causes a segfault. depayer 和 stat object 都不是 null,但是gst_structure_has_field(stat,"timestamp")
会导致段错误。 Any help is much appreciated.任何帮助深表感谢。
I guess you can try我想你可以试试
GstStructure *stat;
// GstRTPBaseDepayload* depayload;
g_object_get(depayer_,"stats",&stat,NULL);
notice I used &stat
in g_object_get
, not stat
.请注意我在g_object_get
中使用了&stat
,而不是stat
。
https://docs.gtk.org/gobject/method.Object.get.html https://docs.gtk.org/gobject/method.Object.get.html
I found an example: https://github.com/pexip/gst-rtsp-server/blob/master/examples/test-mp4.c#L38-L42我找到了一个例子: https://github.com/pexip/gst-rtsp-server/blob/master/examples/test-mp4.c#L38-L42
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.