Bharti Subtitles

Bharti Subtitles

By aiguru
Details
View on WordPress

Pick a video in your Media Library, press one button, and get a subtitle file
attached to it. Visitors then see a subtitles button on the video player.

The speech-to-text runs in the browser, on the machine of whoever pressed
the button. Not on your server, and not on anyone’s API. That single decision
is what this plugin is, and everything below follows from it.

Nothing leaves the computer

There are two ways to turn speech into text: send the audio somewhere and get
the words back, or run the model where the audio already is. This plugin does
the second.

For a marketing clip either way is fine. For patient education, legal
recordings, internal training, HR material or paid membership content, sending
the file to a third party is often the difference between allowed and not
allowed
.

The browser reads the file, works on it, and writes the result back. The only
thing that ever downloads is the speech model itself, once.

No account, no key, no bill

  • Nothing to sign up for. No OpenAI account, no API key to create, store,
    rotate or explain to a client.
  • No per-minute charge. Transcription services meter audio by the minute.
    Nothing here is metered — caption the same course twice, or a hundred hours
    of it, and the cost does not change.
  • No server load. Your host never transcodes or transcribes anything, so
    this runs on the cheapest shared hosting without a queue, a cron job or a
    worker process.

How it works

  1. Go to Media > Bharti Subtitles, choose a video and the spoken language, press
    Generate subtitles
  2. Watch the lines appear, then fix anything the model misheard — names and
    technical words are usually where it slips
  3. Press Save to this video. The .vtt is written beside the video and
    attached to it

Or download .srt / .vtt instead and take it to YouTube, Vimeo or a video
editor.

What you get

  • 17 languages, including Hindi, Marathi and Hinglish written in Roman
    script
  • Every line editable before you save
  • Works with the Gutenberg Video block and the classic [video] shortcode
  • Control how the subtitles look — font, size, bold, capitals, colour,
    background and opacity, shadow, position and alignment — with a live preview
  • Translation ready, with a .pot file included

Accessibility

Captions for prerecorded video are a WCAG 2.1 requirement (Success Criterion
1.2.2). If your site has an accessibility obligation, this is one of the items
on the list.

Honest limits

Most of this would normally be left out of a plugin page. It is here because
the wrong expectation wastes your time and mine.

  • The first run downloads the speech model — about 50 MB for most
    languages, about 250 MB for Hindi, Marathi and Hinglish, which need a larger
    one. The browser keeps it, so it is once per machine, not once per video.
  • Speed depends on the machine, not the hosting. A modern laptop manages
    roughly real time or better. An old one will be slower.
  • No bulk or overnight processing. One video at a time, with a browser tab
    open. Doing it in bulk would mean a server doing the work, and then the zero
    cost and the privacy both disappear.
  • Hindi, Marathi and Hinglish need more correcting than English. The model
    has seen far less of them. What you get is a usable draft to fix, which is
    much faster than typing from nothing — but it is a draft, and the panel says
    so before you press the button.
  • The video must be one your browser can play. MP4 (H.264 + AAC) and WebM
    are safest. HEVC inside a .mov will not decode.

What it needs

  • A current version of Chrome, Edge, Firefox or Safari
  • An internet connection the first time, to download the speech model
  • A writable uploads folder — the .vtt is saved beside the video

Source code and build

The two files in assets/js/ are built, not written by hand. Their complete
source ships inside this plugin so nothing needs to be taken on trust:

  • src/ — all of the TypeScript and React that becomes them
  • package.json, tsconfig.json, vite.config.ts, vite.worker.config.ts
    the build configuration

To rebuild from that source:

npm install
npm run build

which regenerates assets/js/subtitles.js and
assets/js/transcribe-worker.js exactly as shipped.

Third-party code

Bundled into those two files by the build, both unmodified:

  • React 18.3 — https://github.com/facebook/react — MIT
  • Transformers.js 3.8.1 — https://github.com/huggingface/transformers.js —
    Apache-2.0

External services

Two things are downloaded into the browser the first time you generate
subtitles, and then kept by the browser’s cache. Nothing is uploaded, no
account is needed, and no key is required.

The speech engine

  • What: ONNX Runtime Web, the WebAssembly engine that runs the model.
    Part of Transformers.js, pinned to version 3.8.1.
  • Server: jsDelivr — https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.8.1/dist/
  • When: the first time you press Generate subtitles, once per browser.
  • Sent: nothing. It is a download.

The speech model

  • What: an OpenAI Whisper model, converted for the browser. About 50 MB
    for most languages, about 250 MB for Hindi, Marathi and Hinglish.
  • Server: Hugging Face — https://huggingface.co/
  • When: the first time you use a given language, once per browser.
  • Sent: nothing. It is a download.

Your video is never sent to either of them, or to anywhere else. It is read
from your own Media Library by your own browser and worked on there.

Terms and privacy: jsDelivr — https://www.jsdelivr.com/terms and
https://www.jsdelivr.com/terms/privacy-policy-jsdelivr-net · Hugging Face —
https://huggingface.co/terms-of-service and https://huggingface.co/privacy

Serving them yourself

If your site cannot reach an outside server — some government, medical and
internal deployments cannot, and jsDelivr is blocked in some countries — put
the files on your own host and point the plugin at them:

add_filter( 'bharti_subtitles_wasm_paths', function () {
    return 'https://example.com/onnx/'; 
} );

The files to copy are the contents of @huggingface/transformers@3.8.1/dist/.
The model can be self-hosted the same way; see the Transformers.js
documentation for env.remoteHost.

Be honest with yourself about this before installing: if the first run cannot
reach these two servers, the plugin cannot generate subtitles. After that
first run it works offline.

Details

Plugin code:
bharti-subtitles
Plugin version:
1.0.0
Author:
Outdated:
No
WP version:
6.2 or higher
PHP version:
7.4 or higher
Test up to WP version:
7.1
Total installations:
0
Last updated:
2026-09-02
Rating:
Times rated:
0
accessibility
captions
speech-to-text
subtitles
video