在Python中读取和解析Windows视频文件元数据 [英] reading and parsing Windows video files metadata in Python

查看:474
本文介绍了在Python中读取和解析Windows视频文件元数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在一个项目上,我需要读取和解析视频元数据.(持续时间,创建日期,标题,比特率...) 据我所知,没有针对此问题的适用于Python 3.X的好的软件包.

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 -我找到了这些:

hach​​oir-元数据

但是它们是为python 2.X设计的

but they are designed for python 2.X

2 - 我也知道如何使用ffmpeg 和其他处理视频文件的库.但是它们太慢了,我只想从Windows文件中读取元数据.

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 -我尝试使用 exifread 包读取视频元数据,但据我发现,它不适用于视频文件.

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 -出现了问题,要求使用一种方法来检索个视频的长度,但无人接听.

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

我正在寻找这个:

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

平台:

python 3.4 Windows 10

python 3.4 windows 10

推荐答案

我希望您找到了想要的东西. :)

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.

到目前为止,我发现的是一个名为exiftool的命令行工具. 如果下载此软件并使用命令行功能,则可以通过子流程模块运行这些命令.

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. :)

您可以在此处下载该工具

这篇关于在Python中读取和解析Windows视频文件元数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆