Commit 50b7a174 authored by YONG-LIN SU's avatar YONG-LIN SU

Add new file

parents
import subprocess as sp
import threading
host_server='rtsp://192.168.5.17:554/'
soures=['rtsp://ncut0:ecom2828@192.168.5.198/main_0','rtsp://admin:Ecom84253675@120.108.24.88:554/onvif/profile2/media.smp','rtsp://admin:Ecom84253675@120.108.24.89:554/onvif/profile2/media.smp']
destination=['rd/0','mm/in','mm/out']
def push2rtsp(surl,durl):
command='ffmpeg -rtsp_transport tcp -i {0} -c:v copy -an -rtsp_transport tcp -f rtsp {1}'.format(surl,durl)
returncode=sp.call(command,shell=True)
print('error'+str(returncode))
restart(surl,durl)
def restart(surl,durl):
t=threading.Thread(target = push2rtsp, args = (surl,durl,))
t.start()
print('restart'+durl)
# 建立 n 個子執行緒
threads = []
for i in range(len(soures)):
threads.append(threading.Thread(target = push2rtsp, args = (soures[i],host_server+destination[i],)))
threads[i].start()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment