我正在使用 RTP 管道通过本地网络从摄像机流式传输视频。管道是:camera > h264enc > RTP > UDP > receive_and_display
我怎样才能知道延迟是如何构成的?
答案1
如今,GStreamer 拥有非常好的跟踪器机制来测量整个管道或单个元素的延迟
这是可以通过以下方式完成的gst-launch
env GST_DEBUG="GST_TRACER:7" \
GST_TRACERS="latency(flags=element+pipeline)" \
GST_DEBUG_FILE=./latency.log \
gst-launch-1.0 -v videotestsrc pattern=snow ! video/x-raw,width=640,height=480,framerate=30/1 ! videoconvert ! autovideosink
./latency.log
将包含很多这样的日志:
...
0:00:06.072184000 40898 0x11d816920 TRACE GST_TRACER :0:: element-latency, element-id=(string)0x11e848210, element=(string)videotestsrc0, src=(string)src, time=(guint64)16000, ts=(guint64)6072172000;
0:00:06.072209000 40898 0x11d816920 TRACE GST_TRACER :0:: element-latency, element-id=(string)0x11e850440, element=(string)capsfilter0, src=(string)src, time=(guint64)28000, ts=(guint64)6072200000;
0:00:06.072224000 40898 0x11d816920 TRACE GST_TRACER :0:: element-latency, element-id=(string)0x11e824660, element=(string)videoconvert0, src=(string)src, time=(guint64)17000, ts=(guint64)6072217000;
0:00:06.072468000 40898 0x11d816920 TRACE GST_TRACER :0:: element-latency, element-id=(string)0x11e83f280, element=(string)autovideosink0, src=(string)src, time=(guint64)21594000, ts=(guint64)6072456000;
....
因此,您可以从这里开始分析time=(guint64)...
每个元素的延迟(值)并尝试不同的设置
这篇文章中有更多详细信息https://gstreamer.freedesktop.org/documentation/additional/design/tracing.html?gi-language=c#use-cases