update README
This commit is contained in:
parent
8f8f2d6d79
commit
04561b96fb
39
README.md
39
README.md
@ -10,16 +10,15 @@ Input a video with hardcoded subtitles:
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# print_sub.py
|
# example.py
|
||||||
|
|
||||||
import videocr
|
from videocr import get_subtitles
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__': # This check is mandatory for Windows.
|
||||||
print(videocr.get_subtitles('video.mp4', lang='chi_sim+eng',
|
print(get_subtitles('video.mp4', lang='chi_sim+eng', sim_threshold=70, conf_threshold=65))
|
||||||
sim_threshold=70, conf_threshold=65))
|
|
||||||
```
|
```
|
||||||
|
|
||||||
`$ python3 print_sub.py`
|
`$ python3 example.py`
|
||||||
|
|
||||||
Output:
|
Output:
|
||||||
|
|
||||||
@ -65,23 +64,21 @@ The OCR process is CPU intensive. It takes 3 minutes on my dual-core laptop to e
|
|||||||
|
|
||||||
2. `$ pip install videocr`
|
2. `$ pip install videocr`
|
||||||
|
|
||||||
## Functions
|
## API
|
||||||
|
|
||||||
```python
|
1. Return subtitle string in SRT format
|
||||||
get_subtitles(
|
```python
|
||||||
video_path: str, lang='eng', time_start='0:00', time_end='',
|
get_subtitles(
|
||||||
conf_threshold=65, sim_threshold=90, use_fullframe=False)
|
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.
|
```
|
||||||
|
|
||||||
|
2. Write subtitles to `file_path`
|
||||||
```python
|
```python
|
||||||
|
save_subtitles_to_file(
|
||||||
save_subtitles_to_file(
|
video_path: str, file_path='subtitle.srt', lang='eng', time_start='0:00', time_end='',
|
||||||
video_path: str, file_path='subtitle.srt', lang='eng', time_start='0:00', time_end='',
|
conf_threshold=65, sim_threshold=90, use_fullframe=False)
|
||||||
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.
|
|
||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user