I'm doing the following to open an RTMP stream using opencv
VideoCapture cap;
cap.open("rtmp://192.168.1.122/live/secret-key0");
Then the program waits for 30 seconds for the connection and then resumes and the video is captures. I want to capture the video instantly the moment the program starts. I there something that I'm missing?
When I try to capture the stream from OBS over RTMP I have no delay in opening the stream using VideoCapture.
Here my VideoWriter statement
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);
The RTMP stream that I'm trying to play is from nginx-rtmp server.