How to get the duration of an HEVC video using Python?

54 Views Asked by At

I have tried this code, but it can't retrieve the frame rate and frame count. Please help me.

import cv2

def with_opencv(filename):
    video = cv2.VideoCapture(filename)

    frame_count = video.get(cv2.CAP_PROP_FRAME_COUNT)
    frame_rate = video.get(cv2.CAP_PROP_FPS)

    return frame_count / frame_rate

print(with_opencv('vid.hevc'))
0

There are 0 best solutions below