根据ffprobe提取的头元数据测试条件筛选媒体文件。

FFfilter的Python项目详细描述


根据头元数据测试条件筛选媒体文件 由ffprobe提取。

安装

pip install fffilter

依赖关系

  • fffilter使用 subprocess到 访问ffprobe的系统安装
  • colorama将是 由pip自动安装

使用

命令行工具

-s--show[键]

返回以制表符分隔的[key]所有值的列表。

# Return the value(s) of display_aspect_ratio
fffilter /path/to/file --show display_aspect_ratio
# Return a list of files, surfacing all possible values of given keys
# (note that '-' must be first argument when receiving piped input if using --show)
find . -name '*.mp4'| fffilter - --show codec_name codec_type display_aspect_ratio

-m--match[键][值]

列出符合所有条件的文件:

  • 匹配的文件列在stdout
  • 不匹配的文件列在stderr上,用红色打印 背景

只需将键和值对传递给 --match参数。

# Return absoulte path for file if its header declares 4:3 aspect
fffilter /path/to/file --match display_aspect_ratio 4:3
# Filter a list of files for h.264-encoded full-HD mp4s
find . -name '*.mp4'| fffilter --match codec_name h264 --match height 1080 --match width 1920 -

模块

fromfffilterimportfffilterpath='media/some_file.mp4'# The show() method requires a path and a list of keysd=fffilter.show(path,['codec_type','display_aspect_ratio'])# The match() method requires a path and either key=value pairs or a packed dictionary: **{'key':'value'}m=fffilter.match(path,codec_type='video',display_aspect_ratio='16:9')print(d)print(m)
{'display_aspect_ratio': [u'16:9'], 'codec_type': [u'audio', u'video']}
True

您还可以调用ffprobe(path)来访问 完整标题:

headers= fffilter.ffprobe(path)
print(headers)
{u'streams': [{u'pix_fmt': u'yuv420p', u'sample_aspect_ratio': u'1:1', u'refs': 1, u'codec_type': u'video', u'coded_height': 720
...

免责声明

此python包不属于 FFmpegFFprobe

学分

fffilter由英国电影研究所的Edward Anderson撰写。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java使用jstl比较jsp中的日期对象   java JSF convertDateTime渲染前一天   java当重定向回另一个servlet时,如何显示错误消息?   当ulimit已更改为unlimit时,java无法增加Wildfly的“最大打开文件数”   Java和SWT:线程和侦听器   Java文件API跨网络复制文件   java如何使用闹钟。安卓系统中的动作\解除\警报   java无法将BLOB保存到数据库(ORA01460:未实现或不需要有意义的转换)   这个for循环的java复杂性   多行上的java正则表达式   spring mvc Java多URL模式,无扩展   java 安卓 json向文本添加超链接   Java泛型和转换   JavaSpringFramework。数据存储库。反应性。反应性积存。save()在从CompletableFuture调用时不持久化数据。运行异步   java ValidationException:调用TraversableResolver。isReachable()引发了异常   java将位图设置为具有特定高度的ImageView   Java:限制字符串中的字符   如何在java中将字节[]类型转换为证书类型?   javascript使用基于java的逻辑编写TinyMCE自定义插件