WebVTT阅读器、编写器和分段器

webvtt-p的Python项目详细描述


https://img.shields.io/pypi/v/webvtt-py.svghttps://travis-ci.org/glut23/webvtt-py.svg?branch=masterDocumentation Status

webvtt-py是用于读/写WebVTT标题文件的python模块。它还具有字幕分割功能,在字幕HLS videos时非常有用。

需要Python3.4+。

文档可在http://webvtt-py.readthedocs.io获得。

安装

$ pip install webvtt-py

用法

importwebvttforcaptioninwebvtt.read('captions.vtt'):print(caption.start)print(caption.end)print(caption.text)

HLS分段

importwebvttwebvtt.segment('captions.vtt','output/path')

转换其他格式的标题

支持的格式:

  • subrip(.srt)
  • YouTube SBV(.sbv)
importwebvttwebvtt=webvtt.from_srt('captions.srt')webvtt.save()# one liner if we just need to convert without editingwebvtt.from_sbv('captions.sbv').save()

cli

标题分段也可以从命令行获得:

$ webvtt segment captions.vtt --output destination/directoy

许可证

根据麻省理工学院的许可证。

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

推荐PyPI第三方库


热门话题
IE中的java跨域cookie问题   重复java中已经满足的循环   编译java RMI服务器时出错   JavaServlet POST中作为参数传递的javascript大型JSON数组数据为空   java片段未每次刷新/调用   java无法编译。错误消息   java如何构造大型类?   java Hibernate:TableThingsDB。事情并不存在   java如何操作从匹配项创建的数组。发现   循环以搜索和显示数组Java的某些部分   加载或注册SQLite JDBC驱动程序时出现java问题   活动和服务之间的java连接   JavaGWTG2D:ie8中的drawImage   java在安卓中设置hessian阈值   在Tomcat中使用Logback时发生java错误