M
M
Maxim Siomin2020-06-03 16:23:48
Python
Maxim Siomin, 2020-06-03 16:23:48

How to find out the length of an mp4 file?

There is an mp4 video. Need to know the length of this video in seconds

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Karbivnichy, 2020-06-03
@MaxSiominDev

In google there are examples of a wagon and a small cart. You can search like this - "python get mp4 duration"
There are many libraries and wrappers for python. One of them is MoviePy. It is of course intended for video editing, but it can also be used to get the length of the video in seconds:
pip install moviepy

from moviepy.editor import VideoFileClip
clip = VideoFileClip("video.mp4")
print(clip.duration)
>>> 153.60

You can also look in the direction of ffmpeg, it will probably work faster)

S
Sergey Sokolov, 2020-06-03
@sergiks

ffprobe

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question