Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
auto-restart-transport-rtsp
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YONG-LIN SU
auto-restart-transport-rtsp
Commits
50b7a174
Commit
50b7a174
authored
Jul 10, 2019
by
YONG-LIN SU
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new file
parents
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
ipcame2easy.py
ipcame2easy.py
+27
-0
No files found.
ipcame2easy.py
0 → 100644
View file @
50b7a174
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment