OpenCv + Gstreamer from an app, getting initial 30s delay

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-24 18:56:42

问题


So my application is exposing an RTP stream using new VideoWriter(pipeline-definition);

The pipeline definition is:

appsrc is-live=1 do-timestamp=1 format=3 stream-type=0 min-latency=0 max-latency=500000000 ! queue leaky=2 max-size-time=500000000 ! videoconvert ! video/x-raw ! x264enc ! h264parse ! rtph264pay config-interval=10 pt=96 ! udpsink host=127.0.0.1 port=9000

The problem I'm faced with is 30s delay in the stream when viewing it in VLC. No matter what I do, VLC is always 29-30s behind. It seems that appsrc is causing this as the same pipeline with videotestsrc has no delay at all.

Any ideas what should I do to make the appsrc release the frames to the stream right away?


回答1:


Seems like the VideoWriter has an internal buffer that caches 30s of footage. In my case I was keeping a singleton in memory and relied on it flushing to the pipeline fast enough. In reality I ended up having to force the VideoWriter to flush the data by releasing it.

I don't recommend this as a solution to the problem but in my case it worked as I need this pipeline only when DEBUG is defined.



来源:https://stackoverflow.com/questions/57521804/opencv-gstreamer-from-an-app-getting-initial-30s-delay

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!