Skip to main content

Frame2Text4LLM

PyPI Tests Docs

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.

The pipeline

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.

Acknowledgements

Frame2Text4LLM is built on open tools, and we thank their authors. OpenCV reads the frames. EasyOCR, PaddleOCR and, through Hugging Face Transformers, Qwen3-VL, Florence-2 and InternVL2 read the subtitles. MMS-LID, from Meta, says which language is spoken. RapidFuzz finds copies, pytubefix downloads videos and ffmpeg cuts the audio.

Frame2Text4LLM itself is under the MIT licence. The tools and models it uses keep their own licences, so check a model's card before using it commercially: the MMS-LID weights that the lid extra downloads, for instance, are under CC BY-NC 4.0.

Authors

Contact: contact@burkimbia.com. MIT licence.

Metadata

Release files for frame2text4llm 0.2.1

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

Source distribution (sdist)

Source distribution for frame2text4llm 0.2.1
File Size Uploaded Provenance Actions
frame2text4llm-0.2.1.tar.gz 38.1 kB With provenance Details for frame2text4llm-0.2.1.tar.gz

Built distribution (wheel)

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

Total release size: 80.8 kB

Release files / frame2text4llm-0.2.1.tar.gz

Download URL frame2text4llm-0.2.1.tar.gz
Size 38.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2557f7b3aa58a0ab5acdd10e5104761dd4fad8720c860538951620496fc4e1d8
BLAKE2b-256 checksum
How to use checksums
dae196d3e3fed0b614b8f886c79250dc075993b71cff50846037db6e04d5b799
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 log

Release files / frame2text4llm-0.2.1-py3-none-any.whl

Download URL frame2text4llm-0.2.1-py3-none-any.whl
Size 42.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4a8951f30049523080c4081368c59cf9463358763af8b7bbec4faec956a3e0f1
BLAKE2b-256 checksum
How to use checksums
559dbacf171136045f64f64f4b088c4d66664f4699436c3d3439965ce149cb61
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 log

Security for frame2text4llm 0.2.1

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.

Select from 2 files

Attestation for frame2text4llm-0.2.1.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 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.1 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