Skip to content

glowinthedark/subtitles-ocr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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