使用RTMP网址进行OpenCV VideoCapture初始化需要30秒钟以上

时间:2020-08-11 18:44:55

标签: opencv nginx gstreamer rtmp obs

我正在执行以下操作以使用opencv打开RTMP流

VideoCapture cap;

cap.open("rtmp://192.168.1.122/live/secret-key0");

然后,程序等待30秒钟进行连接,然后继续播放,并捕获视频。我想在程序启动时立即捕获视频。我有我想念的东西吗?

当我尝试通过RTMP从OBS捕获流时,使用VideoCapture打开流没有延迟。

这是我的VideoWriter声明

VideoWriter out("appsrc ! videoconvert ! queue ! video/x-raw,width=640,height=480 ! videorate ! video/x-raw,framerate=60/1 ! x264enc bitrate=1000 noise-reduction=10000 pass=cbr speed-preset=ultrafast tune=zerolatency ! flvmux name=mux ! rtmpsink location=rtmp://192.168.1.122/live/secret-key0", CAP_GSTREAMER,CV_FOURCC('X','2','6','4'),30,Size(640,480),true);

我要播放的RTMP流来自nginx-rtmp服务器。

0 个答案:

没有答案