DSP发布版本
This commit is contained in:
parent
b33d091cbd
commit
5b20a6502d
|
|
@ -247,13 +247,16 @@ def test5(par):
|
|||
upCnt=1;upLoaded=False
|
||||
while upCnt<4:
|
||||
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')
|
||||
videoId = uploader.uploadLocalVideo(uploadVideoRequest)
|
||||
|
||||
VideoId_AI=str(videoId['VideoId'])
|
||||
|
||||
videoUrl= get_videoUurl(videoBakDir,requestId+'_OR.MP4')
|
||||
assert os.path.exists(videoUrl) , '%s not exists'%(videoUrl)
|
||||
|
||||
videoUrl=os.path.join(videoBakDir,requestId+'_OR.MP4')
|
||||
uploadVideoRequest = UploadVideoRequest(videoUrl, 'offLineVideo')
|
||||
videoId = uploader.uploadLocalVideo(uploadVideoRequest)
|
||||
VideoId_OR=str(videoId['VideoId'])
|
||||
|
|
@ -275,7 +278,8 @@ def test5(par):
|
|||
msg['type']=str(2)
|
||||
msg["request_id"]=requestId
|
||||
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
|
||||
while upCnt<4:
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ from kafka.errors import kafka_errors
|
|||
import utilsK
|
||||
from utilsK.GPUtils 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
|
||||
import random,string
|
||||
|
|
@ -157,19 +157,20 @@ def onlineModelProcess(parIn ):
|
|||
|
||||
childCallback.send('####model load success####')
|
||||
print('#####line153:',outVideoDir,video_flag)
|
||||
os.makedirs( os.path.join(outVideoDir,get_today()) ,exist_ok=True)
|
||||
if (outVideoDir!='NO') : ####2022.06.27新增在线任务也要传AI视频和原始视频
|
||||
if video_flag:
|
||||
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))
|
||||
if vid_writer.isOpened(): outstr='touch video success:%s'%(save_path);level='INFO'
|
||||
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)
|
||||
else:
|
||||
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))
|
||||
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))
|
||||
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'
|
||||
|
|
@ -352,23 +353,7 @@ def lauch_process(gpuid,inSource,outSource,taskId,msgId,modelJson,kafka_par,obje
|
|||
#print(timestr2,'-'*20,'progress:%s ,msgId:%s , taskId:%s return:'%(process_uid,msgId,taskId),child_return)
|
||||
|
||||
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['onLine'] = Queue(100)
|
||||
taskStatus['offLine']= Queue(100)
|
||||
|
|
@ -567,18 +552,6 @@ def detector(par):
|
|||
|
||||
|
||||
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"
|
||||
assert os.path.exists(masterFile)
|
||||
with open(masterFile,'r') as fp:
|
||||
|
|
|
|||
Binary file not shown.
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
11050
logs/send/SendPics.log
11050
logs/send/SendPics.log
File diff suppressed because it is too large
Load Diff
2667
master.log
2667
master.log
File diff suppressed because it is too large
Load Diff
22
producer.py
22
producer.py
|
|
@ -26,8 +26,8 @@ def producer_demo():
|
|||
#pull_channel = "rtmp://live.play.t-aaron.com/live/THSA"
|
||||
#push_channel = 'rtmp://live.push.t-aaron.com/live/THSB'
|
||||
#pull_channel = 'rtmp://live.play.t-aaron.com/live/THSAa_hd'
|
||||
pull_channel = 'http://live.play.t-aaron.com/live/THSAc_hd.m3u8'
|
||||
push_channel = "rtmp://live.push.t-aaron.com/live/THSBc"
|
||||
pull_channel = 'http://live.play.t-aaron.com/live/THSAa_hd.m3u8'
|
||||
push_channel = "rtmp://live.push.t-aaron.com/live/THSBa"
|
||||
else:
|
||||
pull_channel = "rtmp://demoplay.yunhengzhizao.cn/live/THSA_HD5M"
|
||||
push_channel = "rtmp://127.0.0.1:1935/live/test"
|
||||
|
|
@ -39,11 +39,11 @@ def producer_demo():
|
|||
msg_dict = {
|
||||
"request_id":'nn'+''.join(random.sample(string.ascii_letters ,30) ) ,
|
||||
"models":[
|
||||
{
|
||||
"id":"001",
|
||||
"config":{"0":"0", "1":"1","2":"1","3":"1","4":"1"
|
||||
}
|
||||
}
|
||||
{ "id":"0","config":{}},
|
||||
{ "id":"1","config":{}},
|
||||
{ "id":"2","config":{}},
|
||||
{ "id":"3","config":{}},
|
||||
|
||||
],
|
||||
"pull_url":pull_channel,
|
||||
"push_url":push_channel,
|
||||
|
|
@ -69,10 +69,10 @@ def producer_demo():
|
|||
|
||||
"request_id":'bb'+''.join(random.sample(string.ascii_letters ,30) ) ,
|
||||
"models":[
|
||||
{
|
||||
"id":"001",
|
||||
"config":{"0":"1", "1":"1","2":"1","3":"1","4":"1"}
|
||||
}
|
||||
{ "id":"0","config":{}},
|
||||
{ "id":"1","config":{}},
|
||||
{ "id":"2","config":{}},
|
||||
{ "id":"3","config":{}},
|
||||
],
|
||||
"original_url":"http://vod.play.t-aaron.com/customerTrans/c49a2c620795d124f2ae4b10197b8d0e/303b7a58-17f3ef4494e-0004-f90c-f2c-7ec68.mp4",
|
||||
"original_type":"mp4",
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -281,7 +281,7 @@ def get_fps_rtmp(inSource,video=False):
|
|||
cap=cv2.VideoCapture(inSource)
|
||||
if not cap.isOpened():
|
||||
print('#####error url:',inSource)
|
||||
return False
|
||||
return False,[0,0,0,0]
|
||||
|
||||
fps = cap.get(cv2.CAP_PROP_FPS)
|
||||
width = cap.get(cv2.CAP_PROP_FRAME_WIDTH )
|
||||
|
|
@ -300,4 +300,4 @@ def get_fps_rtmp(inSource,video=False):
|
|||
except:
|
||||
return False, [0,0,0,0]
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,19 @@ from kafka import KafkaProducer, KafkaConsumer
|
|||
from voduploadsdk.UploadVideoRequest import UploadVideoRequest
|
||||
from voduploadsdk.AliyunVodUtils import *
|
||||
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):
|
||||
with open(jsonfile) as fp:
|
||||
|
|
|
|||
Loading…
Reference in New Issue