File size: 1,005 Bytes
52d2ec6
8d3c246
 
929496a
 
8d3c246
 
a18f289
9658c13
 
4fc187b
a18f289
5aa5ac4
 
 
8d3c246
a18f289
8d3c246
784d811
4fc187b
a18f289
9658c13
 
 
f5637b7
5aa5ac4
 
 
8d3c246
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
#### IMPORT #####
import cv2
import time
import streamlit as st

### CONNECT TO CAMERA 

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'
    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'
            capture[i] = cv2.VideoCapture(strrtsp)
            print ("reconectando... frame invalido "+strrtsp)
    time.sleep(0.025)