DSP发布版本

This commit is contained in:
thsw 2022-07-25 08:59:03 +08:00
parent b33d091cbd
commit 5b20a6502d
14 changed files with 27226 additions and 4418 deletions

View File

@ -247,13 +247,16 @@ def test5(par):
upCnt=1;upLoaded=False upCnt=1;upLoaded=False
while upCnt<4: while upCnt<4:
try: try:
videoUrl=os.path.join(videoBakDir,requestId+'_AI.MP4') videoUrl= get_videoUurl(videoBakDir,requestId+'_AI.MP4')
assert os.path.exists(videoUrl) , '%s not exists'%(videoUrl)
uploadVideoRequest = UploadVideoRequest(videoUrl, 'offLineVideo') uploadVideoRequest = UploadVideoRequest(videoUrl, 'offLineVideo')
videoId = uploader.uploadLocalVideo(uploadVideoRequest) videoId = uploader.uploadLocalVideo(uploadVideoRequest)
VideoId_AI=str(videoId['VideoId']) VideoId_AI=str(videoId['VideoId'])
videoUrl=os.path.join(videoBakDir,requestId+'_OR.MP4') videoUrl= get_videoUurl(videoBakDir,requestId+'_OR.MP4')
assert os.path.exists(videoUrl) , '%s not exists'%(videoUrl)
uploadVideoRequest = UploadVideoRequest(videoUrl, 'offLineVideo') uploadVideoRequest = UploadVideoRequest(videoUrl, 'offLineVideo')
videoId = uploader.uploadLocalVideo(uploadVideoRequest) videoId = uploader.uploadLocalVideo(uploadVideoRequest)
VideoId_OR=str(videoId['VideoId']) VideoId_OR=str(videoId['VideoId'])
@ -275,7 +278,8 @@ def test5(par):
msg['type']=str(2) msg['type']=str(2)
msg["request_id"]=requestId msg["request_id"]=requestId
msg['results'][0]['original_url']= taskInfos['original_url'] msg['results'][0]['original_url']= taskInfos['original_url']
videoUrl=os.path.join(videoBakDir,requestId+'.MP4') videoUrl= get_videoUurl(videoBakDir,requestId+'.MP4')
assert os.path.exists(videoUrl) , '%s not exists'%(videoUrl)
upCnt=1;upLoaded=False upCnt=1;upLoaded=False
while upCnt<4: while upCnt<4:
try: try:

View File

@ -22,7 +22,7 @@ from kafka.errors import kafka_errors
import utilsK import utilsK
from utilsK.GPUtils import * from utilsK.GPUtils import *
from utilsK.masterUtils import * from utilsK.masterUtils import *
from utilsK.sendUtils import create_status_msg,update_json from utilsK.sendUtils import create_status_msg,update_json,get_today
#from utilsK.modelEval import onlineModelProcsss #from utilsK.modelEval import onlineModelProcsss
import random,string import random,string
@ -157,19 +157,20 @@ def onlineModelProcess(parIn ):
childCallback.send('####model load success####') childCallback.send('####model load success####')
print('#####line153:',outVideoDir,video_flag) print('#####line153:',outVideoDir,video_flag)
os.makedirs( os.path.join(outVideoDir,get_today()) ,exist_ok=True)
if (outVideoDir!='NO') : ####2022.06.27新增在线任务也要传AI视频和原始视频 if (outVideoDir!='NO') : ####2022.06.27新增在线任务也要传AI视频和原始视频
if video_flag: if video_flag:
request_id = streamName.split('-')[2] request_id = streamName.split('-')[2]
save_path = os.path.join(outVideoDir,request_id+'.MP4') save_path = os.path.join(outVideoDir,get_today(),msgId+'.MP4')
vid_writer = cv2.VideoWriter(save_path, cv2.VideoWriter_fourcc(*'mp4v'), fps, (outW,outH)) vid_writer = cv2.VideoWriter(save_path, cv2.VideoWriter_fourcc(*'mp4v'), fps, (outW,outH))
if vid_writer.isOpened(): outstr='touch video success:%s'%(save_path);level='INFO' if vid_writer.isOpened(): outstr='touch video success:%s'%(save_path);level='INFO'
else:outstr='touch video failed:%s'%(save_path);level='ERROR' else:outstr='touch video failed:%s'%(save_path);level='ERROR'
writeELK_log(msg=outstr,fp=fp_log,level=level,line=sys._getframe().f_lineno,logger=logger) writeELK_log(msg=outstr,fp=fp_log,level=level,line=sys._getframe().f_lineno,logger=logger)
else: else:
request_id = streamName.split('-')[2] request_id = streamName.split('-')[2]
save_path_OR = os.path.join(outVideoDir,request_id+'_OR.MP4') save_path_OR = os.path.join(outVideoDir,get_today(),msgId+'_OR.MP4')
vid_writer_OR = cv2.VideoWriter(save_path_OR, cv2.VideoWriter_fourcc(*'mp4v'), fps, (outW,outH)) vid_writer_OR = cv2.VideoWriter(save_path_OR, cv2.VideoWriter_fourcc(*'mp4v'), fps, (outW,outH))
save_path_AI = os.path.join(outVideoDir,request_id+'_AI.MP4') save_path_AI = os.path.join(outVideoDir,get_today(),msgId+'_AI.MP4')
vid_writer_AI = cv2.VideoWriter(save_path_AI, cv2.VideoWriter_fourcc(*'mp4v'), fps, (outW,outH)) vid_writer_AI = cv2.VideoWriter(save_path_AI, cv2.VideoWriter_fourcc(*'mp4v'), fps, (outW,outH))
if vid_writer_AI.isOpened() and vid_writer_OR.isOpened() :outstr='touch video success:%s,%s'%(save_path_OR,save_path_AI);level='INFO' if vid_writer_AI.isOpened() and vid_writer_OR.isOpened() :outstr='touch video success:%s,%s'%(save_path_OR,save_path_AI);level='INFO'
else:outstr='touch video failed:%s,%s, fps:%d ,%d , %d'%(save_path_OR,save_path_AI,fps,outW,outH);level='ERROR' else:outstr='touch video failed:%s,%s, fps:%d ,%d , %d'%(save_path_OR,save_path_AI,fps,outW,outH);level='ERROR'
@ -353,22 +354,6 @@ def lauch_process(gpuid,inSource,outSource,taskId,msgId,modelJson,kafka_par,obje
return gpuProcess return gpuProcess
msg_dict_offline = {
"biz_id":"hehuzhang",
"mod_id":"ai",
"request_id":'bb'+''.join(random.sample(string.ascii_letters ,30) ) ,
"offering_id":"http://vod.play.t-aaron.com/customerTrans/c49a2c620795d124f2ae4b10197b8d0e/303b7a58-17f3ef4494e-0004-f90c-f2c-7ec68.mp4",
"offering_type":"mp4",
"results_base_dir": "XJRW202203171535"+str(random.randint(10,99)),
'outSource':'NO'
}
taskStatus={} taskStatus={}
taskStatus['onLine'] = Queue(100) taskStatus['onLine'] = Queue(100)
taskStatus['offLine']= Queue(100) taskStatus['offLine']= Queue(100)
@ -567,18 +552,6 @@ def detector(par):
if __name__ == '__main__': if __name__ == '__main__':
par={};
###topic0--在线topic1--离线
#par['server']='212.129.223.66:9092';par['topic']=('thsw','thsw2','testReturn');par['group_id']='test';
#101.132.127.1:19092
'''
par['server']='101.132.127.1:19092 ';par['topic']=('alg-online-tasks','alg-offline-tasks','alg-task-results');par['group_id']='test';
par['kafka']='mintors/kafka'
par['modelJson']='conf/model.json'
'''
masterFile="conf/master.json" masterFile="conf/master.json"
assert os.path.exists(masterFile) assert os.path.exists(masterFile)
with open(masterFile,'r') as fp: with open(masterFile,'r') as fp:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

2667
master.log

File diff suppressed because it is too large Load Diff

View File

@ -26,8 +26,8 @@ def producer_demo():
#pull_channel = "rtmp://live.play.t-aaron.com/live/THSA" #pull_channel = "rtmp://live.play.t-aaron.com/live/THSA"
#push_channel = 'rtmp://live.push.t-aaron.com/live/THSB' #push_channel = 'rtmp://live.push.t-aaron.com/live/THSB'
#pull_channel = 'rtmp://live.play.t-aaron.com/live/THSAa_hd' #pull_channel = 'rtmp://live.play.t-aaron.com/live/THSAa_hd'
pull_channel = 'http://live.play.t-aaron.com/live/THSAc_hd.m3u8' pull_channel = 'http://live.play.t-aaron.com/live/THSAa_hd.m3u8'
push_channel = "rtmp://live.push.t-aaron.com/live/THSBc" push_channel = "rtmp://live.push.t-aaron.com/live/THSBa"
else: else:
pull_channel = "rtmp://demoplay.yunhengzhizao.cn/live/THSA_HD5M" pull_channel = "rtmp://demoplay.yunhengzhizao.cn/live/THSA_HD5M"
push_channel = "rtmp://127.0.0.1:1935/live/test" push_channel = "rtmp://127.0.0.1:1935/live/test"
@ -39,11 +39,11 @@ def producer_demo():
msg_dict = { msg_dict = {
"request_id":'nn'+''.join(random.sample(string.ascii_letters ,30) ) , "request_id":'nn'+''.join(random.sample(string.ascii_letters ,30) ) ,
"models":[ "models":[
{ { "id":"0","config":{}},
"id":"001", { "id":"1","config":{}},
"config":{"0":"0", "1":"1","2":"1","3":"1","4":"1" { "id":"2","config":{}},
} { "id":"3","config":{}},
}
], ],
"pull_url":pull_channel, "pull_url":pull_channel,
"push_url":push_channel, "push_url":push_channel,
@ -69,10 +69,10 @@ def producer_demo():
"request_id":'bb'+''.join(random.sample(string.ascii_letters ,30) ) , "request_id":'bb'+''.join(random.sample(string.ascii_letters ,30) ) ,
"models":[ "models":[
{ { "id":"0","config":{}},
"id":"001", { "id":"1","config":{}},
"config":{"0":"1", "1":"1","2":"1","3":"1","4":"1"} { "id":"2","config":{}},
} { "id":"3","config":{}},
], ],
"original_url":"http://vod.play.t-aaron.com/customerTrans/c49a2c620795d124f2ae4b10197b8d0e/303b7a58-17f3ef4494e-0004-f90c-f2c-7ec68.mp4", "original_url":"http://vod.play.t-aaron.com/customerTrans/c49a2c620795d124f2ae4b10197b8d0e/303b7a58-17f3ef4494e-0004-f90c-f2c-7ec68.mp4",
"original_type":"mp4", "original_type":"mp4",

1703
send.log

File diff suppressed because it is too large Load Diff

View File

@ -281,7 +281,7 @@ def get_fps_rtmp(inSource,video=False):
cap=cv2.VideoCapture(inSource) cap=cv2.VideoCapture(inSource)
if not cap.isOpened(): if not cap.isOpened():
print('#####error url:',inSource) print('#####error url:',inSource)
return False return False,[0,0,0,0]
fps = cap.get(cv2.CAP_PROP_FPS) fps = cap.get(cv2.CAP_PROP_FPS)
width = cap.get(cv2.CAP_PROP_FRAME_WIDTH ) width = cap.get(cv2.CAP_PROP_FRAME_WIDTH )

View File

@ -18,7 +18,19 @@ from kafka import KafkaProducer, KafkaConsumer
from voduploadsdk.UploadVideoRequest import UploadVideoRequest from voduploadsdk.UploadVideoRequest import UploadVideoRequest
from voduploadsdk.AliyunVodUtils import * from voduploadsdk.AliyunVodUtils import *
from voduploadsdk.AliyunVodUploader import AliyunVodUploader from voduploadsdk.AliyunVodUploader import AliyunVodUploader
from datetime import datetime, date, timedelta
def get_today():
return date.today().strftime("%Y-%m-%d")
def get_yesterday(beforeday=-1):
return (date.today() + timedelta(days =beforeday)).strftime("%Y-%m-%d")
def get_videoUurl(videoBakDir,filename):
###七天时间内
potentialUrls=[ os.path.join( videoBakDir,get_yesterday(beforeday=-x),filename) for x in range(7) ]
existsList=[os.path.exists(x ) for x in potentialUrls]
for i,flag in enumerate(existsList):
if flag: return potentialUrls[i]
return potentialUrls[0]
def getNamedic(jsonfile): def getNamedic(jsonfile):
with open(jsonfile) as fp: with open(jsonfile) as fp: