Warning: this project is still under development. It is only suitable for 1080p videos, and the coodinates of subtitles on video frames is hardcoded as well as the subtitles themselves.
-
Install the dependencies using pip:
pip install progressbar2 baidu-aip opencv-python-headless numpy
-
Edit
config.json
file.- Note to change the value of
videosDir
to the path of videos folder on your computer. splitDuration
is the time intervals between every processed frame from all frames in a video. The default value is1
second.- Please create an app using OCR APIs from Baidu AI Platform, and fill in the AppID, API Key and Secret Key in
config.json
.
- Note to change the value of
-
Run
python get_frames.py
to get subtitle images fromvideosDir
and save them to a folder(subtitleImgsDir
inconfig.json
) -
Run
python ocr_subtitles.py <video_name>
to convert subtitle images to a text file inresultsDir
.