问题描述
大家好,我想做这样的事情(不相关的代码被省略): 1.将处理后的opencv mat对象写入gstreamer pipline(共享内存)
cv::Mat resize_cap_img;
//open pipline to shmsrc
videoToRtspServer.open("appsrc blocksize=8192 ! shmsink socket-path=/tmp/foo1 sync=true wait-for-connection=false shm-size=10000000 max-lateness=20000000000",\
cv::CAP_GSTREAMER,-1,(double)1,cv::Size(960,540),true);
videoToRtspServer.write(resize_cap_img);
2.Gstreamer rtsp服务器通过shmsrc从共享内存中读取mat对象并对其进行处理,然后将其作为视频流推送
GST_DEBUG=2 ./test-launch "( shmsrc socket-path=/tmp/foo1 ! video/x-raw,format=BGR,width=960,height=540,framerate=4/1 ! videoconvert ! video/x-raw,format=I420,framerate=4/1 ! x264enc ! rtph264pay name=pay0 pt=96 )"
在rtsp://127.0.0.1:8554 / test上准备好流
3。按地址rtsp://127.0.0.1:8554 / test播放视频流
gst-launch-1.0 playbin uri=rtsp://192.168.1.151:8554/test
最后,播放RTSP视频的时间比使用“ imshow(resize_cap_img)”直接显示Mat对象的时间慢16秒 谁能告诉我造成延迟的原因以及解决方法。请提前感谢您。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)