Spaces:
Runtime error
Runtime error
File size: 1,151 Bytes
52d2ec6 8d3c246 929496a 8d3c246 3d547bb a18f289 b858e8f 4fc187b a18f289 b858e8f 4409d4d 5aa5ac4 8d3c246 a18f289 8d3c246 784d811 4fc187b a18f289 9658c13 f5637b7 b858e8f 5aa5ac4 cf01853 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
#### 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) |