STTN Subtitle Remover

STTN_SUBTITLE_REMOVER

Removes burned-in subtitles and captions from a video: finds the text on every frame and fills it in from the rest of the clip. Also fills any area you mark with a mask video.

Video Editingvideo-inpaintingsubtitle-removaltext-removalmitFine-tunable
STTN Subtitle Remover: Video Editing model on Kainguru

About STTN Subtitle Remover

Capabilities

  • Finds the text itself — in the lower third of the clip, or in a region you give, on every frame; any script the detector reads
  • Or your mask — send a mask video (white = remove) to fill logos, watermarks or anything else you marked
  • Same clip back — the result keeps the clip's size, frame rate and sound; only the pixels under the removed area change
  • Fine-tuning — teach it to fill gaps in your kind of footage from your own clips

Good to know

  • Clips are MP4, MOV, WebM or MKV, up to 200 MB, 450 frames and 3840 pixels a side. The text is looked for on a copy of at most 1280 pixels on the longer side; the result has the clip's own size (H.264 stores pixels in pairs, so an odd width or height loses one pixel, and the result says the size it has) and is encoded again, so even untouched pixels carry a second round of compression.
  • Without a mask video, text is looked for in the lower third of the clip, or in the region you give as a JSON array [x0, y0, x1, y1] in pixels of the clip. All text in the region is removed, scene text too; send a mask video to remove only what you choose. A mask video and a region cannot be given together.
  • A mask video has the clip's frame count (its size may differ: it is scaled), white where to remove. The margin (0 to 32 pixels, 6 by default) grows what is removed around the text or the mask, to take its outline and shadow.
  • If no text is found, or the mask marks nothing, the request fails and nothing is billed beyond the failed request.
  • STTN sees 432 x 240 pixels: the removed area and its surroundings are cut out, filled and scaled back. It suits thin captions over live action best; large or finely textured areas come out soft.
  • You pay for the frames of the clip. Use it on videos you own or have the right to edit.
  • Fine-tuning takes one ZIP (at most 4 GB, no password) with 2 to 200 clips of footage without captions, each of 6 to 300 frames, and manifest.jsonl, one {"video": ..., "mask": ...} line per clip, paths relative to it; "mask" is an optional mask video with the clip's frame count. Clips without one are trained with random text-line boxes and drifting boxes as the holes to fill.
  • Training shows the generator samples of 5 frames at 432 x 240 and the authors' losses, with a discriminator beside it that is not kept. It stops after 3000 steps or 9 hours, whichever comes first, and keeps what it has learned.

Attribution

STTN by Yanhong Zeng, Jianlong Fu and Hongyang Chao (Learning Joint Spatial-Temporal Transformations for Video Inpainting, ECCV 2020), released under the MIT License. Text detection: the PP-OCRv5 server detection model by PaddlePaddle, Apache License 2.0.

STTN Subtitle Remover inputs and output

NameTypeRequiredDefaultDetails
videofileYes—The clip: MP4, MOV, WebM or MKV, at most 200 MB, 450 frames and 3840 pixels a side. The result has its size, frame rate and sound.
1–2048 characters · video/mp4, quicktime, webm, x-matroska
maskfileNo—Optional: what to remove, as a video with the clip's frame count (white = remove; at most 100 MB). Without it, the text found in the region is removed.
1–2048 characters · video/mp4, quicktime, webm, x-matroska
marginintegerNo6Pixels the removed area grows around the text found or the mask, to take its outline and shadow.
0–32
regiontextNo—Optional, without a mask video: where to look for text, JSON [x0, y0, x1, y1] in pixels of the clip. The lower third of the clip when left out.
Max 128 characters

Output. Returns MP4 video: The clip without what was removed: H.264 MP4 at the clip's size (an odd width or height loses one pixel) and frame rate, with its sound when MP4 carries it. The result also gives the frames that changed.

Run STTN Subtitle Remover with the API

Send your API key in the X-API-Key header. The run is asynchronous: submit it, then poll it until it finishes. Create an API key.

cURL
curl -X POST "https://api.kainguru.com/api/v1/executions?mlFlowId=STTN_SUBTITLE_REMOVER" \
  -H "X-API-Key: kg_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "input": {
    "video": "https://example.com/input.png",
    "margin": 6
  },
  "outputFormat": "json"
}'

# Poll until the execution reaches a terminal state
curl "https://api.kainguru.com/api/v1/executions/{executionId}" \
  -H "X-API-Key: kg_your_api_key"
Python
from kainguru import KainguruClient

with KainguruClient(api_key="kg_your_api_key", base_url="https://api.kainguru.com/api") as client:
    submitted = client.executions.execute(
        "STTN_SUBTITLE_REMOVER",
        {
          "video": "https://example.com/input.png",
          "margin": 6
        },
        output_format="json",
    )
    result = client.executions.await_completion(submitted.id)
    print(result.execution.output)

Fine-tune STTN Subtitle Remover

You can fine-tune STTN Subtitle Remover on your own data and run the tuned model through the same API. Dataset: One ZIP (at most 4 GB, no password) with 2 to 200 clips of your footage without captions, each at most 300 frames, and manifest.jsonl: a {"video", "mask"?} line per clip. More in Good to know, in the README.

The steps are in the docs.

STTN Subtitle Remover pricing

Price per frame: 0.3496 credits ($0.003496). The price is shown again before every run; all prices are on the pricing page.

Licence and source

Background Matting v2: Video Editing model on Kainguru
Video Editing

Background Matting v2

Cuts a person out of video precisely, hair included, when you also give a picture of the empty background from the…

Fine-tunable
DeOldify Video: Video Editing model on Kainguru
Video Editing

DeOldify Video

Colourises black-and-white video with DeOldify's video model: plausible colour for every frame, laid over the original…

Fine-tunable
MuseTalk 1.5: Video Editing model on Kainguru
Video Editing

MuseTalk 1.5

Makes a face in a video say new words. Send a clip of one talking face and an audio file; the mouth and jaw move to…

Fine-tunable
RIFE 4.26: Video Editing model on Kainguru
Video Editing

RIFE 4.26

Raises a video's frame rate 2, 3, 4 or 8 times by predicting the frames in between, fast enough for long clips (RIFE…

Fine-tunable
SVOR: Video Editing model on Kainguru
Video Editing

SVOR

Removes objects from a video. Send a clip and a mask video of what to remove, and it fills the area in, shadows and…

Fine-tunable
Face Anonymizer Video: Video Editing model on Kainguru
Video Editing

Face Anonymizer Video

Finds every face in a short video and covers it on each frame with a blur, pixelation or a solid box.