Introduction

  • This article is aimed towards helping beginner Python programmers to quickly start using the RapidVideOCR subtitle extraction tool
  • Supported operating systems: `Windows | Mac | Linux``

Environment Configuration

1. Install VideoSubFinder (used for extracting subtitle keyframes)

2. Install python(used for running RapidVideOCR)

1. Download the Python installer

Open the official Python website → https://www.python.org, and select the installer for your own operating system (VideoSubFinder is currently only available for Windows)>

2. Find the version you want

Take Python 3.10.7 for example, if the download speed is too slow you can join the RapidVideOCR QQ group: (706807542) to download the files.

3. After the download is complete, double-click to open the exe and start the installation

Click Customize installation and select the installation location. Also, remember to check the last item Add Python 3.10 to PATH

4. Click Next

5. Check the installation path

6. Click install, and wait for the installation to finish

7. Press Win + r input cmd, and press Enter to open the command prompt

8. Enter python and see if an output something similar to the following image appears. If so, then the installation was successful

9. Add the Scripts directory to the environment variables

  • Press Win + q enter Edit the system→ Click Edit the system environment variables

  • Click Environment VariablesUser variablesPathEdit

  • Create a new entry for the Script directory under the Python installation directory, as shown in the image below, and remember to click save.

3. Install RapidVideOCR

1. Press Win + r input cmd, and press Enter to open the command prompt

2. Install rapid_videocr

  pip install rapid_videocr -i https://pypi.tuna.tsinghua.edu.cn/simple/
  

3. To test whether the installation was successful, enter rapid_videocr -h

4. Command line usage

Press Win + r input cmd, and press Enter to open the command prompt

  rapid_videocr -i RGBImages -s result -m concat
  

RGBImages is generated by VideoSubFinder and its output path can be customized, for example: G:\ProgramFiles\_self\RapidVideOCR\test_files\RGBImages and so on.

5. Script usage

  1. Create a new TXT file on the desktop and name it rapid_videocr.py. Note that the file extension is changed to *.py.

  2. Open rapid_videocr.py with Notepad and copy the following code into it

      from rapid_videocr import RapidVideOCR, RapidVideOCRInput
    
    # RapidVideOCRInput has two initialization parameters
    # is_concat_rec: Use a single image for recognition or not. The default is False, which means that a single image is used for recognition by default.
    # concat_batch: The number of images to be used in overlay is 10 by default and can be adjusted
    # out_format: Output format selection, [srt, txt, all], the default is all
    # is_print_console: Whether to print the result, [0, 1], the default is 0 for not printing
    ocr_input_params = RapidVideOCRInput(
        is_batch_rec=False, ocr_params={"Global.with_paddle": True}
    )
    extractor = RapidVideOCR(ocr_input_params)
    
    rgb_dir = "tests/test_files/RGBImages"
    save_dir = "outputs"
    save_name = "a"
    
    # outputs/a.srt  outputs/a.t
    extractor(rgb_dir, save_dir, save_name=save_name)
      
  3. Change rgb_dir to the path to the RGBImages directory generated by VideoSubFinder。

  4. Press Win + r and open the command prompt, and run the following commands

      $ cd Desktop
    $ python rapid_videocr.py
      

Last updated 21 May 2025, 19:10 -0600 . history