diff --git a/modelcenter/PP-HumanV2/APP/pipeline/pipeline.py b/modelcenter/PP-HumanV2/APP/pipeline/pipeline.py index 2aa69c8fab803ce99c8c4d276742d1bc4bb72d30..cdb28a92631e139ade94bdadab8e84500a62b51a 100644 --- a/modelcenter/PP-HumanV2/APP/pipeline/pipeline.py +++ b/modelcenter/PP-HumanV2/APP/pipeline/pipeline.py @@ -389,8 +389,7 @@ class PipePredictor(object): def set_file_name(self, path): if path is not None: - if "." in path: - self.file_name = path.split(".")[-2] + self.file_name = path else: # use camera id self.file_name = None @@ -446,9 +445,9 @@ class PipePredictor(object): frame_count = int(capture.get(cv2.CAP_PROP_FRAME_COUNT)) print("video fps: %d, frame_count: %d" % (fps, frame_count)) - video_out_name = 'output' if self.file_name is None else self.file_name - out_path = video_out_name + "_output.mp4" - fourcc = cv2.VideoWriter_fourcc(*'mp4v') + video_name,suffix = os.path.splitext(self.file_name) + out_path = video_name + "_output"+suffix + fourcc = int(capture.get(cv2.CAP_PROP_FOURCC)) writer = cv2.VideoWriter(out_path, fourcc, fps, (width, height)) frame_id = 0 diff --git a/modelcenter/PP-TinyPose/APP/det_keypoint_unite_infer.py b/modelcenter/PP-TinyPose/APP/det_keypoint_unite_infer.py index a5178cce7df757db2ed9daab17888d3bd19e8402..9e058e8620653558b2ba89fd58b5a18c195b925f 100644 --- a/modelcenter/PP-TinyPose/APP/det_keypoint_unite_infer.py +++ b/modelcenter/PP-TinyPose/APP/det_keypoint_unite_infer.py @@ -107,18 +107,18 @@ def topdown_unite_predict_video(FLAGS, capture = cv2.VideoCapture(camera_id) else: capture = cv2.VideoCapture(FLAGS.video_file) - video_name,suffix = FLAGS.video_file.split('.') - video_name = video_name+"_output."+suffix + video_name,suffix = os.path.splitext(FLAGS.video_file) + video_name = video_name+"_output"+suffix + # Get Video info : resolution, fps, frame count width = int(capture.get(cv2.CAP_PROP_FRAME_WIDTH)) height = int(capture.get(cv2.CAP_PROP_FRAME_HEIGHT)) fps = int(capture.get(cv2.CAP_PROP_FPS)) frame_count = int(capture.get(cv2.CAP_PROP_FRAME_COUNT)) print("fps: %d, frame_count: %d" % (fps, frame_count)) - - - fourcc = cv2.VideoWriter_fourcc(* 'mp4v') - writer = cv2.VideoWriter(video_name, fourcc, fps, (width, height)) + + codec = int(capture.get(cv2.CAP_PROP_FOURCC)) + writer = cv2.VideoWriter(video_name, codec, fps, (width, height)) index = 0 store_res = [] keypoint_smoothing = KeypointSmoothing( diff --git a/modelcenter/PP-Vehicle/APP/pipeline/pipeline.py b/modelcenter/PP-Vehicle/APP/pipeline/pipeline.py index 124a8a6dd06149aceeea17c33d5105ad888cbfdb..eb568175dca57291cefdf859b039c5630ac87d3d 100644 --- a/modelcenter/PP-Vehicle/APP/pipeline/pipeline.py +++ b/modelcenter/PP-Vehicle/APP/pipeline/pipeline.py @@ -329,8 +329,7 @@ class PipePredictor(object): def set_file_name(self, path): if path is not None: - if "." in path: - self.file_name = path.split(".")[-2] + self.file_name = path else: # use camera id self.file_name = None @@ -397,9 +396,9 @@ class PipePredictor(object): frame_count = int(capture.get(cv2.CAP_PROP_FRAME_COUNT)) print("video fps: %d, frame_count: %d" % (fps, frame_count)) - video_out_name = 'output' if self.file_name is None else self.file_name - out_path = video_out_name + "_output.mp4" - fourcc = cv2.VideoWriter_fourcc(*'mp4v') + video_name,suffix = os.path.splitext(self.file_name) + out_path = video_name + "_output"+suffix + fourcc = int(capture.get(cv2.CAP_PROP_FOURCC)) writer = cv2.VideoWriter(out_path, fourcc, fps, (width, height)) frame_id = 0