glowinthedark / subtitles-ocr

Hard-burned subtitles OCR to SRT extractor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hard-burned subtitles OCR to SRT extractor

The workflow sequence run by the do-all.sh script:

  1. Generate cropped video with ffmpeg (you'll have to adjust the crop area for your video size)
  2. Generate PNG snapshots (using ffmpeg ... fps=1 — 1 snapshot per second)
  3. Optical Character Recognition using macOCR (Apple Silicon only) outputs JSON file.
  4. Convert JSON to SRT + normalize and deduplicate using https://github.com/cdown/srt.
  5. optional: Generate Chinese pinyin and traditional/simplified versions.
  6. optional: Translate with deepl.
  7. optional: Merge translation into the final SRT containing Hanzi Simplified + Hanzi Traditional + Pinyin + English.

NOTE

  • this collection of scripts is work in progress and will require tweaking for each specific scenario (the corresponding places that need editing are marked with TODO comments in the code); use at your own risk

About

Hard-burned subtitles OCR to SRT extractor

License:Apache License 2.0


Languages

Language:Python 91.1%Language:Shell 8.9%