Q:

OpenCV can't open network stream from gstreamer created by raspberry

I'm trying to open an unicast udp stream from my Raspberry pi using Gstreamer. This stream will be received on a Windows PC using a C++ application with OpenCV. This is the shellscript i use on the raspberry to start the stream:
raspivid -t 0 -h 1080 -w 1920 -fps 30 -hf -vf -n -b 6000000 -o - | gst-launch-1.0 -e -vvvv  fdsrc ! h264parse !  rtph264pay config-interval=5 pt=96 ! udpsink host=192.168.0.101 port=5001

I am able to receive and display the footage on my Windows PC using a batch file like this:
@echo off
cd C:\gstreamer\1.0\x86_64\bin
gst-launch-1.0 -e -v udpsrc port=5001 ! application/x-rtp, payload=96 ! rtpjitterbuffer ! rtph264depay ! avdec_h264 ! fpsdisplaysink sync=false text-overlay=false

To be able to use this stream in my C++ application I use Opencv. I am not familiar with opening a stream using Opencv. I'm trying to open the stream using the following code:
    cv::VideoCapture cap("udp://@:5001");
    if (!cap.isOpened()) {
        printf("=ERR= can't create video capture\n");
        return -1;
    }

When I run my application it gets stuck (not crashing) at cv::VideoCapture cap("udp://@:5001"); every time. I'm not sure what the input parameters are between the quotation marks. When I wireshark the stream I get this result: 

Source:192.186.0.103 Destination:192.168.0.101 Protocol:UDP Length:1442 Info:35946->5001 Len=1400

Obviously this is just one of the many packages.
Can anyone help me with those input parameters or show me another way to open the stream in OpenCV?

A:

OpenCv supports gstreamer and you can input pipes to VideoCapture. What you need to do is finish your pipe with appsink.
In your case you might use
const char* pipe = "udpsrc port=5001 ! application/x-rtp, payload=96 ! rtpjitterbuffer ! rtph264depay ! avdec_h264 ! appsink"
cv::VideoCapture cap(pipe);

