fix
This commit is contained in:
parent
1af7662867
commit
da4f22f8f9
|
@ -56,6 +56,11 @@ class VdHelper:
|
|||
new_width = p
|
||||
new_height = int(float(self._height) * rate)
|
||||
|
||||
if new_width % 2 != 0:
|
||||
new_width -= 1
|
||||
if new_height % 2 != 0:
|
||||
new_height -= 1
|
||||
|
||||
return new_width, new_height
|
||||
|
||||
def transfer_h264_720p_25fps(self, output_path):
|
||||
|
@ -71,30 +76,6 @@ class VdHelper:
|
|||
ff.run()
|
||||
|
||||
|
||||
def get_video_w_h(path, p=1080):
|
||||
video = cv2.VideoCapture(path)
|
||||
|
||||
width = int(video.get(cv2.CAP_PROP_FRAME_WIDTH))
|
||||
height = int(video.get(cv2.CAP_PROP_FRAME_HEIGHT))
|
||||
fps = int(video.get(cv2.CAP_PROP_FPS))
|
||||
|
||||
# 横屏 960 * 540
|
||||
if width > height:
|
||||
rate = float(p) / float(height)
|
||||
new_width = int(float(width) * rate)
|
||||
new_height = p
|
||||
else:
|
||||
rate = float(p) / float(width)
|
||||
new_width = p
|
||||
new_height = int(float(height) * rate)
|
||||
|
||||
return width, height, new_width, new_height, fps
|
||||
|
||||
|
||||
# video_path = "bbbbb.mov"
|
||||
# print(get_video_w_h(video_path))
|
||||
|
||||
|
||||
class S:
|
||||
def __init__(self):
|
||||
# self.bucket = oss2.Bucket(oss2.Auth(access_key_id, access_key_secret), endpoint_internal, bucket_name)
|
||||
|
|
Loading…
Reference in New Issue