Hello, i am using openCV v.4.12 (C++) on Windows (VS 2022), and i am trying to get videocapture from sdp file with cv::VideoCapture (“file.sdp”,cv::CAP_FFMPEG), but erros shows that rtp not in white list.
Here is my file.sdp:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 127.0.0.1
t=0 0
m=video 52356 RTP/AVP 97
a=rtpmap:97 H265/90000
I can play the video stream using ffmpeg.exe with no problems, here is a command i am using to run videostream with ffmpeg.exe:
ffmpeg -protocol_whitelist file,udp,rtp -i file.sdp -f sdl2 -
My question is how to correctly set params to cv::Videocapture to get the videostream, if it possible i want to use something like:
cv::VideoCapture cap("protocol_whitelist file,udp,rtp -i file.sdp", cv::CAP_FFMPEG);
Or maybe i should set the OPENCV_FFMPEG_CAPTURE_OPTIONS, but how to do it correctly? I tried to do something like that, but without sucess:
_putenv("OPENCV_FFMPEG_CAPTURE_OPTIONS=protocol_whitelist;file,udp,rtp");
Also as alternative solution i built the OpenCV sources with GSTREAMER backend and was able to get video stream with the followin pipeline:
std::string pipeline =
"udpsrc port=52356 caps=\"application/x-rtp, payload=97, encoding-name=H265\" ! "
"rtph265depay ! h265parse ! avdec_h265 ! videoconvert ! appsink";
cv::VideoCapture cap(pipeline, cv::CAP_GSTREAMER);
if (!cap.isOpened()) {
std::cerr << "Error: Cannot open video stream using GStreamer pipeline!" << std::endl;
return -1;
}
but the videostream is extreamly slow in comparance with ffmpeg.exe or gst-launch-1.0.exe.
Maybe i should set any additional params options… in my sdp file?
Thank you!!!