Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
streamPushPressure
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
李远洪
streamPushPressure
Commits
26f7f1d0
Commit
26f7f1d0
authored
Dec 25, 2020
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加了requirements.txt 文件
parent
783a9a57
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
74 additions
and
23 deletions
+74
-23
lib/protocal/ProtocalFlv_1078.py
lib/protocal/ProtocalFlv_1078.py
+0
-5
lib/protocal/Protocal_1078.py
lib/protocal/Protocal_1078.py
+0
-5
lib/service/StreamH264.py
lib/service/StreamH264.py
+6
-6
lib/testCase/H264PresureTest.py
lib/testCase/H264PresureTest.py
+49
-5
readH264.py
readH264.py
+0
-2
requirements.txt
requirements.txt
+1
-0
streamPullTest.py
streamPullTest.py
+18
-0
No files found.
lib/protocal/ProtocalFlv_1078.py
View file @
26f7f1d0
#coding:utf-8
import
binascii
import
socket
from
ctypes
import
string_at
import
time
import
cv2
class
Protocal_1078
:
def
__init__
(
self
):
...
...
lib/protocal/Protocal_1078.py
View file @
26f7f1d0
#coding:utf-8
import
binascii
import
socket
from
ctypes
import
string_at
import
time
import
cv2
class
Protocal_1078
:
def
__init__
(
self
):
...
...
lib/service/StreamH264.py
View file @
26f7f1d0
...
...
@@ -19,8 +19,8 @@ class StreamH264():
self
.
channel
=
1
# 频道号
# self.host = "10.100.11.125"
self
.
host
=
"10.16.12.249"
#
self.host = "10.100.12.3"
#
self.host = "10.16.12.249"
self
.
host
=
"10.100.12.3"
# self.host = "localhost"
self
.
port
=
1078
self
.
client
=
None
...
...
@@ -575,12 +575,12 @@ class StreamH264():
if
__name__
==
"__main__"
:
obj
=
StreamH264
()
obj
.
connectServer
()
obj
.
setFPSVideo
(
30
)
obj
.
setFPSAudio
(
47
)
obj
.
setFPSVideo
(
24
)
obj
.
setFPSAudio
(
54
)
obj
.
setSendDur
(
0.001
)
obj
.
setAVChangeBySecond
(
2
)
obj
.
setVideoPath
(
"../../h264/
bbb3
.h264"
)
obj
.
setAudioPath
(
"../../aac/
bbb3
.aac"
)
obj
.
setVideoPath
(
"../../h264/
yyy
.h264"
)
obj
.
setAudioPath
(
"../../aac/
yyy
.aac"
)
# obj.readStreamFromFileAndSend("../../h264/bbb.h264") # 发送视频
# obj.readAacStreamFromFileAndSend("../../aac/bbb3.aac") # 发送音频
obj
.
sendAVStream
()
...
...
lib/testCase/H264PresureTest.py
View file @
26f7f1d0
...
...
@@ -2,6 +2,8 @@
import
threading
import
time
import
cv2
from
lib.service.StreamH264
import
StreamH264
...
...
@@ -21,6 +23,14 @@ class H264PresureTest():
self
.
threadInfo
[
"sucessT"
]
=
{}
self
.
threadInfo
[
"failT"
]
=
{}
self
.
threadInfoPull
=
{}
# 存放线程集(拉流线程)
self
.
threadInfoPull
[
"threadObj"
]
=
{}
self
.
threadInfoPull
[
"sucessT"
]
=
{}
self
.
threadInfoPull
[
"failT"
]
=
{}
self
.
isOpenPullStream
=
1
# 是否开启视频拉流 0:不 1:是
self
.
pullUrl
=
"http://10.100.11.125:8085/live?port=1985&app=vandyo&stream="
def
setTerNum
(
self
,
data
):
self
.
terNum
=
data
def
setMobileStart
(
self
,
data
=
"10000000000"
):
...
...
@@ -35,14 +45,32 @@ class H264PresureTest():
self
.
host
=
data
def
setPort
(
self
,
data
):
self
.
port
=
data
def
setIsOpenPullStream
(
self
,
data
):
self
.
isOpenPullStream
=
data
def
testService
(
self
,
cloudMirror
):
def
testServicePush
(
self
,
cloudMirror
):
cloudMirror
.
sendAVStream
()
def
run
(
self
,
mobile
,
threadId
):
def
testServicePull
(
self
,
mobile
):
pullUrl
=
self
.
pullUrl
+
mobile
+
"-"
+
str
(
self
.
channel
)
cap
=
cv2
.
VideoCapture
(
pullUrl
)
while
(
cap
.
isOpened
()):
ret
,
frame
=
cap
.
read
()
if
ret
==
False
:
break
# cv2.imshow("video", frame)
# if cv2.waitKey(1)&0xFF==ord('q'):
# break
print
(
"拉流结束"
)
cap
.
release
()
cv2
.
destroyAllWindows
()
def
runPush
(
self
,
mobile
,
threadId
):
cloudMirror
=
StreamH264
()
cloudMirror
.
setHost
(
self
.
host
)
cloudMirror
.
setPort
(
self
.
port
)
cloudMirror
.
setSendDur
(
0
)
cloudMirror
.
connectServer
()
cloudMirror
.
setFPSVideo
(
30
)
cloudMirror
.
setFPSAudio
(
47
)
...
...
@@ -52,18 +80,33 @@ class H264PresureTest():
cloudMirror
.
setMobile
(
mobile
)
cloudMirror
.
setChannel
(
self
.
channel
)
conThread
=
threading
.
Thread
(
target
=
self
.
testService
,
args
=
(
cloudMirror
,))
conThread
=
threading
.
Thread
(
target
=
self
.
testService
Push
,
args
=
(
cloudMirror
,))
self
.
threadInfo
[
"threadObj"
][
threadId
]
=
conThread
conThread
.
start
()
print
(
threadId
+
"启动了:"
+
mobile
+
"-"
+
str
(
self
.
channel
))
def
runPull
(
self
,
mobile
,
threadId
):
pullThread
=
threading
.
Thread
(
target
=
self
.
testServicePull
,
args
=
(
mobile
,))
self
.
threadInfoPull
[
"threadObj"
][
threadId
]
=
pullThread
pullThread
.
start
()
print
(
threadId
+
"启动了:"
+
mobile
+
"-"
+
str
(
self
.
channel
))
def
start
(
self
):
for
i
in
range
(
0
,
self
.
terNum
):
mobile
=
self
.
mobileStart
+
i
mobile
=
"0"
+
str
(
mobile
)
threadId
=
"threadId__"
+
str
(
i
)
self
.
run
(
mobile
,
threadId
)
time
.
sleep
(
0.1
)
self
.
runPush
(
mobile
,
threadId
)
time
.
sleep
(
0.01
)
if
self
.
isOpenPullStream
==
1
:
for
j
in
range
(
0
,
self
.
terNum
):
mobile
=
self
.
mobileStart
+
j
mobile
=
"0"
+
str
(
mobile
)
threadPullId
=
"threadPullId__"
+
str
(
j
)
self
.
runPull
(
mobile
,
threadPullId
)
time
.
sleep
(
0.01
)
if
__name__
==
"__main__"
:
test
=
H264PresureTest
()
...
...
@@ -72,6 +115,7 @@ if __name__ == "__main__":
test
.
setMobileStart
(
10000000000
)
test
.
setChannel
(
1
)
test
.
setTerNum
(
20
)
test
.
setIsOpenPullStream
(
1
)
# 设置是否开启拉流
test
.
setVideoPath
(
"../../h264/bbb3.h264"
)
test
.
setAudioPath
(
"../../aac/bbb3.aac"
)
test
.
start
()
\ No newline at end of file
readH264.py
View file @
26f7f1d0
#coding: utf-8
import
binascii
def
readH
():
with
open
(
"h264/aaa2.264"
,
'rb'
)
as
f2
:
...
...
requirements.txt
0 → 100644
View file @
26f7f1d0
opencv_python
==4.4.0.46
streamPullTest.py
0 → 100644
View file @
26f7f1d0
#coding: utf-8
import
cv2
cap
=
cv2
.
VideoCapture
(
"http://10.100.11.125:8085/live?port=1985&app=vandyo&stream=013146201117-1"
)
while
(
cap
.
isOpened
()):
ret
,
frame
=
cap
.
read
()
if
ret
==
False
:
break
# cv2.imshow("video", frame)
# if cv2.waitKey(1)&0xFF==ord('q'):
# break
print
(
"拉流结束"
)
cap
.
release
()
cv2
.
destroyAllWindows
()
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