from decord import VideoReader
sys.path.insert(0, '/home/model-server/dev/data_platform/processors')
from aesthetic import get_aesthetic_model, get_aesthetic_score_batch_queue
from mytools.utils import print_with_timestamp as print
from mytools.utils import sleep_for_test
def get_video_length(video_path):
cap = cv2.VideoCapture(video_path)
frame_count=0
if cap.isOpened():
frame_count = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
cap.release()
vreader = VideoReader(video_path)
video_length = len(vreader)
return min(video_length, frame_count)