Forums

Not able to connect to IP Camera on OpenCV Video Capture.!

I am using OpenCV in my python script to open the camera for facedetection. Using the below line to connect to IP Camera using the IP address but its not working here on Python Anywhere.

stream = cv2.VideoCapture('http://192.168.43.1:8485/video')

But FYI, it is working fine both when I am accessing the URL through my browser or when I am triggering the pythron script on my local cmd. Please help me to run the camera through the IP as it is the most crucial part of my project.

You have a free account. Free accounts can only connect to a whitelist of sites and only using htpp(s). Only sites that have a publicly documented API are eligible for the whitelist.

But are you sure, this is the issue, what if it still not get solved if i take the paid plan? isnt there any free trial for just 1 day to try the paid features so that i can be sure of switching to the paid plan

We refund unhappy clients up to 30 days after the upgrade.

ok in that case i can consider going for it

I am using paid plan but facing the same issue, IP webcam not working

Is the camera exposed to the Internet or is it only visible in your local network?

hello! I am having the same issue trying to implement a video stream app. I went with the paid plan but I am still facing issues.

In my case, I am using my phone as an IP camera. More explicitly, I use a third app that assigns an IP to my phone to make use of its camera and stream it on the internet through said IP.

I am using imutils library to read the IP address

cap = VideoStream("https://192.168.45.113:8080/video").start()

Once I open the page, everything on the html is displayed, except the square were the video stream should be.

Do you happen to know if I am doing something wrong? I am new to the hosting and deploying part of my projects. Thank you!

One thing that looks strange there is that the IP address in that code (starting 192.168) is a private one -- that is, no-one can connect to it from the public internet. Is it the address that was provided by the app that is meant to be streaming the video on the Internet?

Thank you for your answer. And yes, the IP is provided by the app. I can see if there is a way to get a public one. If you have any suggestions or workarounds, please, let me know.

One thing I was thinking is maybe doing reverse tunneling (since I can't access the router right now for port forwarding) in order to be able to pass through the ports. Does that make sense?

The problem is that you would need an external IP address for your code on PythonAnywhere (or, equivalently, if you were using JavaScript on your web page) in the browser. I can't really think of any way you could do that with a reverse tunnel.

well, this is quite troublesome. I guess PythonAnywhere is not the hosting solution I should try. If you know any other way to solve this, let me know. Otherwise, I will just cancel my subscrption.

I honestly can't think of any way you could get any hosting solution, PythonAnywhere or otherwise, to access an IP address that is not on the public Internet :-(

I connected my IP cam. I have django app. At this level of dev I want to see the camera image on my frontend. But I see only first frame not really lievefeed. Aby idea what to do?

It's hard to tell without knowing your code. Do you see any errors in the browser dev tools?

Thank you. I solved the problem. I changed the code. It worked on my computer locally. Unfortunatelly it did not work here on server.

My guess is that you're reading the camera through server-side code, so it works on your machine because the server and the camera are on your local machine. When the server code is on PythonAnywhere, then the camera and the code are not on the same machine, so your code cannot access the camera. You will need to use javascript in the browser to connect to the camera.