update README
Yi Ge me@yige.ch
Sun, 15 Dec 2019 22:44:55 +0800
1 files changed,
18 insertions(+),
21 deletions(-)
jump to
M
README.md
→
README.md
@@ -10,16 +10,15 @@ <img width="430" alt="screenshot" src="https://user-images.githubusercontent.com/10210967/56873659-3b76dd00-6a34-11e9-97aa-2c3e96fe3a97.png">
</p> ```python -# print_sub.py +# example.py -import videocr +from videocr import get_subtitles -if __name__ == '__main__': - print(videocr.get_subtitles('video.mp4', lang='chi_sim+eng', - sim_threshold=70, conf_threshold=65)) +if __name__ == '__main__': # This check is mandatory for Windows. + print(get_subtitles('video.mp4', lang='chi_sim+eng', sim_threshold=70, conf_threshold=65)) ``` -`$ python3 print_sub.py` +`$ python3 example.py` Output:@@ -65,23 +64,21 @@ 1. Install [Tesseract](https://github.com/tesseract-ocr/tesseract/wiki) and make sure it is in your `$PATH`
2. `$ pip install videocr` -## Functions - -```python -get_subtitles( - video_path: str, lang='eng', time_start='0:00', time_end='', - conf_threshold=65, sim_threshold=90, use_fullframe=False) -``` -Return the subtitles string in SRT format. +## API - -```python +1. Return subtitle string in SRT format + ```python + get_subtitles( + video_path: str, lang='eng', time_start='0:00', time_end='', + conf_threshold=65, sim_threshold=90, use_fullframe=False) + ``` -save_subtitles_to_file( - video_path: str, file_path='subtitle.srt', lang='eng', time_start='0:00', time_end='', - conf_threshold=65, sim_threshold=90, use_fullframe=False) -``` -Write subtitles to `file_path`. If the file does not exist, it will be created automatically. +2. Write subtitles to `file_path` + ```python + save_subtitles_to_file( + video_path: str, file_path='subtitle.srt', lang='eng', time_start='0:00', time_end='', + conf_threshold=65, sim_threshold=90, use_fullframe=False) + ``` ### Parameters