reading and parsing Windows video files metadata i

2019-07-29 09:04发布

问题:

I'm working on a project and I need to read and parse video metadata.(duration, date created,title,bit rate , ...) as far as I know there isn't any good package for Python 3.X for this issue.

1 -- I found these :

enzyme

hachoir-metadata

but they are designed for python 2.X

2 -- I also know how to use ffmpeg and other libraries that process video files. but they are so slow, I want to simply read the metadata from the windows file.

3 -- I tried to use exifread package to read video metadata , but as far as I found out , it doesn't work on video files.

4 -- there was this question that asked for a way to retrieve only length of videos, but it is unanswered.

I'm looking for this:

file = open(path_to_video_file)
props = python_video_info_parser.get_info(file)
print(props)

platform:

python 3.4 windows 10

回答1:

I hope you found what you are looking for. :)

But if you did not or others are wondering.. I am researching the same sunject and I may have found a solution.

What I have found so far is a command-line tool called exiftool. If you download this software and use the command line feature you are able to run these commands with the subprocess module.

There is support for a lot of file formats, as shown in the documentation.

I will update this post as soon as I have found a working soltuion. :)

You can download the tool here.