Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mirrorSimulator
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
李远洪
mirrorSimulator
Commits
b60558c2
Commit
b60558c2
authored
Jan 20, 2021
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改了视频抓拍和图片抓拍的兼容性问题
parent
88564035
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
8 deletions
+20
-8
lib/service/StreamH264Flv.py
lib/service/StreamH264Flv.py
+4
-2
start.pyw
start.pyw
+4
-0
ui/CameraArea.py
ui/CameraArea.py
+10
-5
ui/globalParams.py
ui/globalParams.py
+2
-1
No files found.
lib/service/StreamH264Flv.py
View file @
b60558c2
...
...
@@ -13,6 +13,7 @@ from pubsub import pub
from
lib.protocal.Protocal_1078
import
Protocal_1078
from
lib.socket.ClientSocket
import
ClientSocket
from
ui
import
globalParams
class
StreamH264Flv
():
...
...
@@ -36,8 +37,9 @@ class StreamH264Flv():
self
.
videoPath
=
"../../flv/bbb3.flv"
# 要推流的视频路劲
self
.
getGetPlayUrl
=
"http://10.100.11.110:9999/video/streamInfo"
# 获取推流播放地址的url
# self.getGetPlayUrl = "http://fb-test.vandyo.com/video/streamInfo" # 获取推流播放地址的url
curPath
=
sys
.
path
[
0
]
with
open
(
curPath
+
"/config/config.yaml"
,
'r'
,
encoding
=
"utf-8"
)
as
fi
:
# curPath = sys.path[0]
# with open(curPath + "/config/config.yaml", 'r', encoding="utf-8") as fi:
with
open
(
globalParams
.
scriptPath
+
"/config/config.yaml"
,
'r'
,
encoding
=
"utf-8"
)
as
fi
:
fi_data
=
fi
.
read
()
data
=
yaml
.
load
(
fi_data
,
Loader
=
yaml
.
FullLoader
)
self
.
getGetPlayUrl
=
data
[
"globalCon"
][
"getPlayUrl"
]
...
...
start.pyw
View file @
b60558c2
#coding: utf-8
import
os
from
ui.MainWindow
import
MainWindow
from
ui
import
globalParams
if
__name__
==
"__main__"
:
globalParams
.
scriptPath
=
os
.
getcwd
()
MainWindow
()
.
show
()
\ No newline at end of file
ui/CameraArea.py
View file @
b60558c2
...
...
@@ -30,8 +30,10 @@ class CameraArea():
self
.
host
=
"10.100.11.125"
self
.
port
=
"1078"
curPath
=
sys
.
path
[
0
]
with
open
(
curPath
+
"/config/config.yaml"
,
'r'
,
encoding
=
"utf-8"
)
as
fi
:
# curPath = sys.path[0]
# with open(curPath + "/config/config.yaml", 'r', encoding="utf-8") as fi:
with
open
(
globalParams
.
scriptPath
+
"/config/config.yaml"
,
'r'
,
encoding
=
"utf-8"
)
as
fi
:
fi_data
=
fi
.
read
()
data
=
yaml
.
load
(
fi_data
,
Loader
=
yaml
.
FullLoader
)
self
.
getGetPlayUrl
=
data
[
"globalCon"
][
"getPlayUrl"
]
...
...
@@ -549,10 +551,11 @@ class CameraArea():
# 获取视频时长
####################################################
def
getVideoDur
(
self
,
theFile
):
cmd
=
'
ffprobe.exe -show_format '
+
theFile
cmd
=
globalParams
.
scriptPath
+
'/
ffprobe.exe -show_format '
+
theFile
p
=
subprocess
.
Popen
(
cmd
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
stdin
=
subprocess
.
DEVNULL
,
shell
=
True
)
p
.
wait
()
...
...
@@ -617,13 +620,14 @@ class CameraArea():
inFi
=
self
.
videoPathText
.
GetValue
()
videoLen
=
self
.
getVideoDur
(
inFi
)
curtimeO
=
self
.
getCurTimeO
()
curPath
=
sys
.
path
[
0
]
curPath
=
globalParams
.
scriptPath
outFi
=
curPath
+
"/SDCard/video/"
+
curtimeO
+
"_"
+
str
(
videoLen
)
+
"__"
+
str
(
capTime
)
+
".mp4"
self
.
splitVideo
(
capTime
,
capdur
,
inFi
,
outFi
)
timeCur
=
int
(
time
.
time
())
self
.
uploadFile
(
cam
,
outFi
,
2
,
timeCur
)
ws
.
sendMsg
(
replyMsg
)
wx
.
CallAfter
(
pub
.
sendMessage
,
"showLog"
+
str
(
self
.
channel
),
msg
=
cutTime
+
"视频抓拍完成!"
)
####################################################
...
...
@@ -640,7 +644,7 @@ class CameraArea():
else
:
capTime
=
str
(
int
(
self
.
pushObj
.
getTimeStamp
()
/
1000
))
inFi
=
self
.
videoPathText
.
GetValue
()
curPath
=
sys
.
path
[
0
]
curPath
=
globalParams
.
scriptPath
videoLen
=
self
.
getVideoDur
(
inFi
)
curtimeO
=
self
.
getCurTimeO
()
outFi
=
curPath
+
"/SDCard/picture/"
+
curtimeO
+
"_"
+
str
(
videoLen
)
+
"__"
+
str
(
capTime
)
+
".jpg"
...
...
@@ -650,3 +654,4 @@ class CameraArea():
timeCur
=
int
(
time
.
time
())
self
.
uploadFile
(
cam
,
outFi
,
1
,
timeCur
)
ws
.
sendMsg
(
replyMsg
)
wx
.
CallAfter
(
pub
.
sendMessage
,
"showLog"
+
str
(
self
.
channel
),
msg
=
cutTime
+
"图片抓拍完成!"
)
ui/globalParams.py
View file @
b60558c2
...
...
@@ -6,4 +6,5 @@ camera_2 = None # 相机2
camera_3
=
None
# 相机3
eventArea
=
None
# 事件发送对象
isLogRedirect
=
0
# 日志是否重定向到日志文本框 0: 不重定向 (用于调试) 1:重定向 (用于给别人用)
isLogRedirect
=
1
# 日志是否重定向到日志文本框 0: 不重定向 (用于调试) 1:重定向 (用于给别人用)
scriptPath
=
""
# 脚本执行的目录
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