|
@@ -23,27 +23,13 @@ class Recommend:
|
|
@classmethod
|
|
@classmethod
|
|
def get_video_info_from_local(cls, video_path):
|
|
def get_video_info_from_local(cls, video_path):
|
|
probe = ffmpeg.probe(video_path)
|
|
probe = ffmpeg.probe(video_path)
|
|
- # print('video_path: {}'.format(video_path))
|
|
|
|
- # format1 = probe['format']
|
|
|
|
- # bit_rate = int(format1['bit_rate']) / 1000
|
|
|
|
- # duration = format['duration']
|
|
|
|
- # size = int(format1['size']) / 1024 / 1024
|
|
|
|
video_stream = next((stream for stream in probe['streams'] if stream['codec_type'] == 'video'), None)
|
|
video_stream = next((stream for stream in probe['streams'] if stream['codec_type'] == 'video'), None)
|
|
if video_stream is None:
|
|
if video_stream is None:
|
|
print('No video stream found!')
|
|
print('No video stream found!')
|
|
return
|
|
return
|
|
width = int(video_stream['width'])
|
|
width = int(video_stream['width'])
|
|
height = int(video_stream['height'])
|
|
height = int(video_stream['height'])
|
|
- # num_frames = int(video_stream['nb_frames'])
|
|
|
|
- # fps = int(video_stream['r_frame_rate'].split('/')[0]) / int(video_stream['r_frame_rate'].split('/')[1])
|
|
|
|
duration = float(video_stream['duration'])
|
|
duration = float(video_stream['duration'])
|
|
- # print('width: {}'.format(width))
|
|
|
|
- # print('height: {}'.format(height))
|
|
|
|
- # print('num_frames: {}'.format(num_frames))
|
|
|
|
- # print('bit_rate: {}k'.format(bit_rate))
|
|
|
|
- # print('fps: {}'.format(fps))
|
|
|
|
- # print('size: {}MB'.format(size))
|
|
|
|
- # print('duration: {}'.format(duration))
|
|
|
|
return width, height, duration
|
|
return width, height, duration
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|