# cv::VideoCapture with FFMPEG parameters

**URL:** <https://forum.opencv.org/t/cv-videocapture-with-ffmpeg-parameters/23018>\
**Category:** Uncategorized\
**Tags:** video-streaming, ffmpeg\
**Created:** [July 9, 2025, 4:14pm UTC](https://forum.opencv.org/t/cv-videocapture-with-ffmpeg-parameters/23018 "2025-07-09T16:14:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Bilityuk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/alex_bilityuk/32/2949_2.png) [@Alex\_Bilityuk](https://forum.opencv.org/u/Alex_Bilityuk)\
**Post date:** [July 9, 2025, 4:14pm UTC](https://forum.opencv.org/t/cv-videocapture-with-ffmpeg-parameters/23018/1 "2025-07-09T16:14:45Z")

</div>

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:

```auto
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:

```auto
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!!!
