Extract duration of video file without external pr

2019-07-08 02:33发布

问题:

Is there a way to extract the duration information from a video file's metadata (or maybe calculate the duration some other way) in python without invoking an external process. I've found a number of answers that reference using ffprobe but that isn't an option for me. I need this to be all self contained within the python app.

The file formats I need to process are .mp4, .mov, .mxf and preferably as many other common video file formats as possible.


Edit: I am using python 3.x so unfortunately it appears hachoir-metadata is not an option as it only operates with python 2.7