Commit 26f7f1d0 authored by liyuanhong's avatar liyuanhong

添加了requirements.txt 文件

parent 783a9a57
#coding:utf-8
import binascii
import socket
from ctypes import string_at
import time
import cv2
class Protocal_1078:
def __init__(self):
......
#coding:utf-8
import binascii
import socket
from ctypes import string_at
import time
import cv2
class Protocal_1078:
def __init__(self):
......
......@@ -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()
......
......@@ -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.testServicePush,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
#coding: utf-8
import binascii
def readH():
with open("h264/aaa2.264", 'rb') as f2:
......
#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()
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