Forum >> Programmazione Python >> Web e Reti >> WEBCAM visionabile da web

Pagina: 1

Ciao a tutti,sono nuovo di python,sto cominciano a sviluppare come esercizio dei programmini,ho provato a comandare la WEBCAM usb da remoto,ma riesco solo tramite MOTION a vederla utilizzando lo stesso wifi.
In pratica scrivo l ip con finale 8081: e funziona,io vorrei riuscire a visionarla al di fiori del wifi di casa, ossia da web.

Non sono riuscito con nessuna guida a farcela,esiste un programmino fatto da qualcuno che mi aiuti,magari anche ua sempice videosorveglianza.




Grazie Marco :ok:


--- Ultima modifica di Marco12121984 in data 2021-04-18 13:50:15 ---
Messaggio nascosto da Daniele aka Palmux :
SPAM
To view your USB webcam feed outside your home Wi-Fi network, you'll need to make the feed accessible on the internet. Here's a summarized plan:

1. Set Up Motion with Flask for Web Access

Use the Motion package to stream your webcam feed locally (as you've already done).
Create a Python Flask app that serves the Motion feed.

2. Expose Your Local Server to the Internet

Use a tool like ngrok to expose your local server to the internet securely.

Install ngrok: pip install pyngrok.
Expose your Motion feed running on port 8081:
from pyngrok import ngrok
public_url = ngrok.connect(8081)
print("Public URL:", public_url)





3. Forward Port via Router (Optional)

If you want direct access (without ngrok), configure port forwarding on your router for port 8081to your local IP.
Be cautious of security risks and set up authentication (eg, HTTP Basic Auth).

4. Simple Python Surveillance App Example
from flask import Flask, Response

app = Flask(__name__)

@app.route('/')
def webcam_feed():
return Response(
"Streaming Motion Feed from localhost:8081",
headers={"Refresh": "0.1; url=http://localhost:8081"}
)

if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)


Run the Flask app, then expose it using ngrok or your router.


Hope my sharing is useful with you.
Thank you for sharing the summarized plan for accessing a USB webcam feed outside the home Wi-Fi network. However, can you explain port forwarding in more detail?























Pagina: 1



Esegui il login per scrivere una risposta.