Spaces:
Runtime error
Runtime error
#### IMPORT ##### | |
import cv2 | |
import time | |
import streamlit as st | |
### CONNECT TO CAMERA | |
# rtsp://177.94.213.14:554/user=atualli&password=Ope1w3r&channel=2&stream=0.sdp | |
capture = [1,2,3,4,5,6,7,8] | |
ip = '177.94.213.14' | |
#ip = '192.168.0.131' | |
for x in range(1): | |
#capture[x] = cv2.VideoCapture('rtsp://atualli:Atualli22@'+ip+':1024/Streaming/channels/'+str(x+1)+'02/?transportmode=unicast') | |
strrtsp = 'rtsp://'+ip+':554/user=atualli&password=Ope1w3r&channel='+str(x+1)+'&stream=0.sdp' | |
#strrtsp = "teste.mp4" | |
capture[x] = cv2.VideoCapture(strrtsp) | |
print (strrtsp) | |
pic = [st.empty(),st.empty(),st.empty(),st.empty(),st.empty(),st.empty(),st.empty(),st.empty()] | |
while True: | |
for i in range(1): | |
x, frame = capture[i].read() | |
if x: | |
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) | |
pic[i].image(frame) | |
else: | |
strrtsp = 'rtsp://'+ip+':554/user=atualli&password=Ope1w3r&channel='+str(i+1)+'&stream=0.sdp' | |
#strrtsp = "teste.mp4" | |
capture[i] = cv2.VideoCapture(strrtsp) | |
print ("reconectando... frame invalido "+strrtsp) | |
#time.sleep(0.025) |