Frame2Text4LLM
By Alban Nyantudre and Salif Sawadogo, for BurkimbIA.
Read the subtitles burned into a video with OCR, find when each one starts and ends, and cut the audio underneath. What comes out is pairs of speech and text, for speech recognition or speech translation datasets in languages that have few of them.
Install
pip install "frame2text4llm[easyocr]"
OCR engines are extras: easyocr, paddle, vlm (Qwen3-VL, Florence-2, InternVL2), openai; lid
adds the spoken-language check, copies the copy check, and all installs them all. Audio cuts need
ffmpeg.
Use
from frame2text4llm.export.audio_generator import AudioGenerator
from frame2text4llm.framer import VideoReader
from frame2text4llm.language import LanguageID
from frame2text4llm.ocr import OCRBatchProcessor, OCRManager
from frame2text4llm.ocr.utils import mark_non_subtitles, windows
reader = VideoReader("episode.mp4")
frames = reader.extract_frames(target_fps=2)
h, w = frames[0].image.shape[:2]
manager = OCRManager(reader, region=(int(h * 0.7), h, 0, w))
segments = OCRBatchProcessor(manager).process_batch(
frames, tool="easyocr", lang="fr", n_cores=1, merge_segments=True, overlay_frames=60
)
mark_non_subtitles(segments, duration=len(frames) / 2)
cuts = windows(segments)
paths = AudioGenerator("episode.mp4", tmp_audio_dir="cuts").extract_segments(cuts)
heard = LanguageID().hear(paths) # the lid extra
overlay_frames=60 takes logos and banners out of the frames, mark_non_subtitles marks credits and
scrolling text, and windows joins the subtitles into windows of 5 to 30 s, each cut as one audio file.
How it works shows each step on a sample video.
Which engine
Measured on 48 subtitle frames from four Burkinabè series with French subtitles:
| engine | character error | seconds per image (T4) |
|---|---|---|
Qwen3-VL-2B (tool="vlm") |
0.5 % | 1.18 |
| PaddleOCR | 3.5 % | 1.38 (CPU) |
| EasyOCR | 37.5 % | 0.05 |
We find subtitles with EasyOCR and read each one once with Qwen3-VL-2B. Choosing an OCR engine has the details.
Documentation
https://burkimbia.github.io/Frame2Text4LLM/
Develop
uv sync
uv run pytest
uv run --only-group docs mkdocs serve
To release, follow RELEASE.md.
Authors
Contact: frame2text4llm@gmail.com. MIT licence.
Metadata
Release files for frame2text4llm 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| frame2text4llm-0.2.0.tar.gz | 37.7 kB | With provenance | Details for frame2text4llm-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| frame2text4llm-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for frame2text4llm-0.2.0-py3-none-any.whl |
Total release size: 80.1 kB
Release files / frame2text4llm-0.2.0.tar.gz
| Download URL | frame2text4llm-0.2.0.tar.gz |
|---|---|
| Size | 37.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a4298b5a35a841ff2ca8542af2936119706cc157e89ad5517005efc2c81a40bd
|
|
BLAKE2b-256 checksum How to use checksums |
dc7b17fa5a4d922d62d2ed6c465ac9426edd59d895334789d90bcf1bd03feb60
|
| 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 Nov 19, 2026.
Transparency logRelease files / frame2text4llm-0.2.0-py3-none-any.whl
| Download URL | frame2text4llm-0.2.0-py3-none-any.whl |
|---|---|
| Size | 42.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cef3e3a9cbe85ef58e8f4ae0e620a0d6c0894de59654daa4b576baab9149393f
|
|
BLAKE2b-256 checksum How to use checksums |
b46896b7be06c0f42cb330a7a9659c28087d8937d6e391af7c4c8c1945c7a5ae
|
| 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 Nov 19, 2026.
Transparency logSecurity for frame2text4llm 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
Both files in this release have been uploaded with provenance metadata.
Attestation for frame2text4llm-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 Nov 19, 2026.
Transparency logA 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.