How to get InMemoryFileUpload video file's duration in django

46 Views Asked by At

I've searched about that in the SO, but there solutions with video file's path. I need to get file's duration by InMemoryFileUpload or BytesIO in django. How can do that?

from moviepy.editor import VideoFileClip

def video_skip_validator(data):
    video_file = data.get("video")
    video = VideoFileClip(video_file)
    print(video.duration)

It raises 'InMemoryUploadedFile' object has no attribute 'endswith' error.

0

There are 0 best solutions below