V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
MagaFun
V2EX  ›  Python

这个程序是怎样做到自动生成 SRT 文件的?

  •  
  •   MagaFun · 2017-08-23 04:10:02 +08:00 · 3503 次点击
    这是一个创建于 2446 天前的主题,其中的信息可能已经有所发展或是发生改变。

    最近在研究自动字幕,发现了这个程序:agermanidis/autosub

    这款程序可以做到实时生成 SRT 文件,我想问的是这款软件是怎么样做到生成时间轴的? 这块 分析语音的代码我没能看懂,麻烦能简单解释一下吗?提前感谢。

    3 条回复    2017-08-23 05:48:36 +08:00
    Geoion
        1
    Geoion  
       2017-08-23 05:30:19 +08:00
    代码没看完,这块代码大概是切分每句话的长度(帧)
    starvedcat
        2
    starvedcat  
       2017-08-23 05:44:14 +08:00
    看变量命名( is_silence, energy, threshold ),就是通过音量来判断的吧
    starvedcat
        3
    starvedcat  
       2017-08-23 05:48:36 +08:00
    看代码里面用到的 audioop.rms 函数的作用,就是在计算每个 chunk 的声音强度
    https://docs.python.org/2/library/audioop.html#audioop.rms
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2343 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 03:11 · PVG 11:11 · LAX 20:11 · JFK 23:11
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.