Skip to main content

OCR-based subtitle extraction from video files

Project description

cshortranslate

OCR-based subtitle extraction from video files. Designed for extracting Chinese subtitles from long drama videos.

Installation

pip install cshortranslate

For optional video backends:

pip install cshortranslate[pyav]      # PyAV backend
pip install cshortranslate[ffmpegcv]  # ffmpegcv backend
pip install cshortranslate[all]       # All backends

Usage

cshortranslate video.mp4
cshortranslate video.mp4 -o output.srt
cshortranslate video.mp4 --fps 15 --region "bottom:20"
cshortranslate video.mp4 --preview

Options

Option Description
-o, --output Output SRT path (default: <video>.srt)
--fps Frame extraction rate (default: 10)
--region Subtitle region: "bottom:15" for bottom 15%, or "x,y,w,h" in pixels
--preview Show first frame with crop overlay for region selection
--backend Video backend: opencv, pyav, ffmpegcv, degirum
--batch-size Frames to OCR in parallel (default: 1)
--num-workers OCR worker threads (default: 1)
--min-chars Minimum characters to keep (default: 2)
--min-dur Minimum duration in seconds (default: 0.3)

Requirements

  • Python 3.9+
  • rapidocr-onnxruntime
  • opencv-python
  • tqdm
  • numpy

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cshortranslate-0.1.0.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cshortranslate-0.1.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file cshortranslate-0.1.0.tar.gz.

File metadata

  • Download URL: cshortranslate-0.1.0.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cshortranslate-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b338b11c8e8f213dfeba92e5dbf8463a47b6da34c648cb67254bdb10bf7ef964
MD5 dcab1aa2406d7f172c291615b576fd89
BLAKE2b-256 44c49bf4c453c7529ced5847007357a861cb321dda58e65f46d0fe28d6281c25

See more details on using hashes here.

Provenance

The following attestation bundles were made for cshortranslate-0.1.0.tar.gz:

Publisher: publish.yml on Liiesl/cshortranstale

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cshortranslate-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cshortranslate-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cshortranslate-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4285837ece46f1b765f6dd1e76270037c103695084946f9d779ad2498fea8aaa
MD5 8873f26300f91789fdcb7ae2f22a2b8f
BLAKE2b-256 e36733f2be5fdee40276504739b6bc6ac6bb27a9126d7827b3a42a13507c1145

See more details on using hashes here.

Provenance

The following attestation bundles were made for cshortranslate-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Liiesl/cshortranstale

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page