That worked to me thank you!!! Here is the code if someone needs it in the future:
#include <stdio.h>
#include <opencv2/opencv.hpp>
#include <opencv2/highgui.hpp>
int main(){
cv::VideoCapture cap;
cap.open("rtsp://<admin>:<password>@<IP>:<RTSP port>/Streaming/channels/101");
if(!cap.isOpened()){
printf("Error opening video stream\n");
return -1;
}else{
cv::namedWindow("video", cv::WINDOW_NORMAL);
while(true){
cv::Mat frame;
cap >> frame;
if(frame.empty()){
break;
}else{
imshow("Video", frame);
if (cv::waitKey(1)==27){
break;
}
}
}
}
}