Esp32 cam webserver videocapture

I’ve written a code for esp32cam to host a webserver for its camera feed. When i visit from my computer to the url (, the esp32cam captures a photo and shows me on the browser.

I’m running opencv library on codeblocks on a raspberry pi 4. I’ve been able to capture photo from the internet, e.g.: the following code runs perfectly and shows me picture.
VideoCapture capture("");

But The following code fails to fetch image from esp32cam server and times out.
VideoCapture capture("");

I’m new to this. please help.