Skip to main content

flowocr

把视频里出现过的所有文字读出来——不只是底部字幕,还有对话框、名牌、画面上的标注——每条带起止时间(精确到帧), 并按位置自动分成若干条"文字轨"(对白、字幕、界面、水印……)。产物是 SRT,或叠加在原画面上、每条字留在原位的 ASS 字幕。

用来做什么

  • 画面文字翻译:画面各处的文字都读出来、按位置分好轨;在字幕稿里把原文改成译文,叠加时每条译文留在它原来的位置上。
  • 字幕与原文对齐:游戏、影视常常能找到原文剧本。把读到的字幕对上原文,拿到准确的文本和时间轴,用来做翻译字幕。 原神、崩坏:星穹铁道、绝区零有现成的提取工具,按它的说明自己打出文本包(见相关项目)。

能读什么、在哪跑

  • 文字:识别模型是 PaddlePaddle 的 PP-OCRv6(官方称支持约 50 种语言)。实际验证过的是日文(几十小时实况录像和四款游戏的直播录像)与简体中文; 英文只做过零星试跑;竖排文字没测过。
  • 系统:Windows 10 / 11。有 NVIDIA 显卡时走显卡;没有也能跑,用 CPU,慢一到两个数量级。
  • 另要 ffmpeg(完整构建)。

快速开始

要先装 uv 和完整版 ffmpeg;从源码装、参数和产物说明都在 使用手册。

uv tool install "flowocr[nvidia]"                   # 没有 NVIDIA 显卡用 "flowocr[cpu]"
uv tool update-shell                                # 第一次用 uv tool 时,然后重开终端

有原文剧本时,推荐开启匹配器,使用默认配置,先做到阶段 3 的字幕稿;导入 Aegisub 并加载视频,检查文字、时间和位置,改好保存后再跑阶段 4 渲染特效。 下面以星穹铁道为例,先按 game-text-data 的说明准备文本包,放进 gametext\:

flowocr-ocr video.mp4 --out out\v\v.jsonl           # 阶段 1:读字
flowocr-gamescript out\v\v.jsonl --out out\v\v-ref.json --game starrail
flowocr-tracks out\v\v.jsonl --outdir out\v --tag v --matcher gametext --matcher-ctx game=starrail
flowocr-match out\v\v-tracks.json --matcher gametext --ctx ref=out\v\v-ref.json --out out\v\v-matched.json
flowocr-render out\v\v-matched.json --preset script # 阶段 3:只写 v-jp-main.script.ass,默认画匹配器声明的默认组(台词、名牌、选项…)

在 Aegisub 中检查并保存 out\v\v-jp-main.script.ass,然后用 default 预设出特效字幕:

flowocr-typeset out\v\v-jp-main.script.ass --preset default # 阶段 4:写 v-jp-main.ass

原神 / 绝区零把 starrail 换成 genshin / zzz;没有剧本时省略剧本提取与匹配,用 flowocr-tracks 不带匹配参数建轨,再对 v-tracks.json 运行阶段 3,字幕稿为 v-main.script.ass。

相关项目

  • game-text-data:从原神、崩坏:星穹铁道、绝区零的社区解包数据里提取对白文本(中日英对齐), 打成 flowocr 能直接读的文本包。它只公开提取代码,文本本身不分发——要用的话按它的说明自己打包。

问题与参与

  • 用起来有问题、或者在别的显卡 / 机器上跑出了结果,欢迎开 issue。
  • Pull request 请以 main 为目标。开发环境、代码结构和验证方法见 开发指南,全部文档见 文档地图。
  • 版本变化见 CHANGELOG。

许可

GPL-3.0-or-later,全文见 LICENSE。识别用的 PP-OCRv6 模型由 PaddlePaddle 以 Apache-2.0 发布,来源与我们的改动见 LICENSES/。可选的 TensorRT 后端由用户自己从 NVIDIA 下载、按 NVIDIA 的许可协议使用,flowocr 不分发它(说明)。

Metadata

Release files for flowocr 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flowocr 0.2.0
File Size Uploaded Provenance
flowocr-0.2.0.tar.gz 798.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for flowocr 0.2.0
File Interpreter ABI Platform
flowocr-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.7 MB

Release files / flowocr-0.2.0.tar.gz

Download URL flowocr-0.2.0.tar.gz
Size 798.8 kB
Tags Source
SHA-256 checksum
How to use checksums
900d263a46d83689ef716b2f36cda6f53ced599d936ec8b70fdec7397455c52f
BLAKE2b-256 checksum
How to use checksums
08af665290e7d7816797244368425f663fd5700bae97bc7bfbfcde78ff0c940b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Release files / flowocr-0.2.0-py3-none-any.whl

Download URL flowocr-0.2.0-py3-none-any.whl
Size 859.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d2549c93cb299c5325eb29cfcb70bd74a6cc247f1931d14f9943f52a43188da7
BLAKE2b-256 checksum
How to use checksums
fc6d88c5b33bda8166bd8ba5e83a97f2a7f7af29b0cb731eee0b66cf471aea19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Security for flowocr 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for flowocr-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page