CoolFace
Apppublic

trhacknon/camerartsp

sourceHugging Faceapache-2.0updated 3y agoView on Hugging Face
0likes
app.py32 linesDownload Raw Back to root
1#### IMPORT #####2import cv23import time4import streamlit as st5 6### CONNECT TO CAMERA 7# rtsp://177.94.213.14:554/user=atualli&password=Ope1w3r&channel=2&stream=0.sdp8   9capture = [1,2,3,4,5,6,7,8]10ip = '177.94.213.14' 11#ip = '192.168.0.131'12for x in range(1):13    #capture[x] = cv2.VideoCapture('rtsp://atualli:Atualli22@'+ip+':1024/Streaming/channels/'+str(x+1)+'02/?transportmode=unicast')14    strrtsp = 'rtsp://'+ip+':554/user=atualli&password=Ope1w3r&channel='+str(x+1)+'&stream=0.sdp'15    #strrtsp = "teste.mp4"16    capture[x] = cv2.VideoCapture(strrtsp)17    print (strrtsp)18 19pic = [st.empty(),st.empty(),st.empty(),st.empty(),st.empty(),st.empty(),st.empty(),st.empty()]20 21while True:22    for i in range(1):23        x, frame = capture[i].read()24        if x:   25            frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)26            pic[i].image(frame)27        else:28            strrtsp = 'rtsp://'+ip+':554/user=atualli&password=Ope1w3r&channel='+str(i+1)+'&stream=0.sdp'29            #strrtsp = "teste.mp4"30            capture[i] = cv2.VideoCapture(strrtsp)31            print ("reconectando... frame invalido "+strrtsp)32    #time.sleep(0.025)