Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
RaspberryNode
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
簡碩辰
RaspberryNode
Commits
6209b3fb
Commit
6209b3fb
authored
Oct 05, 2019
by
簡碩辰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update run.py
parent
4155a242
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
15 deletions
+22
-15
run.py
dvr/ffmpeg/run.py
+22
-15
No files found.
dvr/ffmpeg/run.py
View file @
6209b3fb
import
json
,
os
,
socket
,
time
,
datetime
,
pytz
,
subprocess
as
SP
import
json
,
os
,
socket
,
time
,
datetime
,
pytz
,
cv2
as
cv
,
subprocess
as
SP
from
paho.mqtt.client
import
Client
as
MQTT
from
colorama
import
Fore
,
Back
,
Style
...
...
@@ -75,7 +75,7 @@ while True:
rtsp_in
=
"{0}/{1}"
.
format
(
rtsp_in
,
key
)
p
=
SP
.
Popen
(
[
command
=
[
'ffmpeg'
,
# DVR to EasyDarwin
'-rtsp_transport'
,
'tcp'
,
# 指定來源協定
'-i'
,
rtsp_in
,
# 指定來源路徑
...
...
@@ -83,9 +83,14 @@ while True:
'-an'
,
# 指定輸出聲音編碼 (an: 無聲音)
'-rtsp_transport'
,
'tcp'
,
# 指定輸出協定
'-f'
,
'rtsp'
,
rtsp_out
,
# 指定輸出格式與路徑
])
]
p
=
SP
.
Popen
(
command
)
try
:
stream
=
cv
.
VideoCapture
(
' '
.
join
(
command
))
if
stream
.
isOpened
():
payload
[
'status'
]
=
1
payload
[
'msg'
]
=
"Ready to Transfer."
...
...
@@ -93,6 +98,8 @@ while True:
client
.
publish
(
topic
,
json
.
dumps
(
payload
),
1
)
p
.
communicate
()
else
:
stream
.
release
()
payload
[
'status'
]
=
0
...
...
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