Skip to main content

Tool for extracting hard subtitles from videos.

Project description

rapid_videocr Package

Documentation Status SemVer2.0

1. Install package by pypi.

pip install rapid_videocr

2. Run by script.

  • Only OCR:
    from rapid_videocr import RapidVideOCR
    
    extractor = RapidVideOCR(is_concat_rec=True,
                            concat_batch=10,
                            out_format='srt')
    
    rgb_dir = 'RGBImages'
    save_dir = 'outputs'
    extractor(video_sub_finder_dir=rgb_dir, save_dir=save_dir)
    
  • Extract + OCR:
    from rapid_videocr import RapidVideoSubFinderOCR
    
    vsf_exe = r"G:\ProgramFiles\VideoSubFinder_6.10_x64\Release_x64\VideoSubFinderWXW.exe"
    extractor = RapidVideoSubFinderOCR(vsf_exe_path=vsf_exe, is_concat_rec=True)
    
    # video_path can be directory path or video full path.
    video_path = 'test_files/tiny/2.mp4'
    save_dir = 'outputs'
    extractor(video_path, save_dir)
    

3. Run by command line.

  • Usage:
    $ rapid_videocr -h
    usage: rapid_videocr [-h] [-vsf VSF_EXE_PATH] [-video_dir VIDEO_DIR] [-i IMG_DIR] [-s SAVE_DIR] [-o {srt,txt,all}] [-m {single,concat}] [-b CONCAT_BATCH] [-p {0,1}]
    
    options:
    -h, --help            show this help message and exit
    -vsf VSF_EXE_PATH, --vsf_exe_path VSF_EXE_PATH
                            The full path of VideoSubFinderWXW.exe.
    -video_dir VIDEO_DIR, --video_dir VIDEO_DIR
                            The full path of video or the path of video directory.
    -i IMG_DIR, --img_dir IMG_DIR
                            The full path of RGBImages or TXTImages.
    -s SAVE_DIR, --save_dir SAVE_DIR
                            The path of saving the recognition result. Default is "outputs" under the current directory.
    -o {srt,txt,all}, --out_format {srt,txt,all}
                            Output file format. Default is "all".
    -m {single,concat}, --mode {single,concat}
                            Which mode to run (concat recognition or single recognition). Default is "single".
    -b CONCAT_BATCH, --concat_batch CONCAT_BATCH
                            The batch of concating image nums in concat recognition mode. Default is 10.
    -p {0,1}, --print_console {0,1}
                            Whether to print the subtitle results to console. 1 means to print results to console. Default is 0.
    
  • Example:
    • Only OCR:
      $ rapid_videocr -i RGBImages
      
    • Extract + OCR:
      $ rapid_videocr -vsf G:\ProgramFiles\VideoSubFinder_6.10_x64\Release_x64\VideoSubFinderWXW.exe -video_dir G:\ProgramFiles\RapidVideOCR\test_files\tiny
      

See details for RapidVideOCR.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

rapid_videocr-2.2.1-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file rapid_videocr-2.2.1-py3-none-any.whl.

File metadata

  • Download URL: rapid_videocr-2.2.1-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for rapid_videocr-2.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 31225bfb73d60c83fe07ff59ece01c158a241c9ee6b32eda77d467dc2c76129c
MD5 efe1d3976df1bc26151a9c482320391f
BLAKE2b-256 eba8eded512e21329f8856be17ded1695b87083dbc68c228c4685333047adc61

See more details on using hashes here.

Supported by

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