all repos — videocr @ eb29dd4d909e976eefe3b34569500ae5976ab2bb

Extract hardcoded subtitles from videos using machine learning

update README
Yi Ge me@yige.ch
Tue, 30 Apr 2019 17:59:10 +0200
commit

eb29dd4d909e976eefe3b34569500ae5976ab2bb

parent

95da09ab7e7348f2b099d223da64ada0bde104eb

1 files changed, 8 insertions(+), 6 deletions(-)

jump to
M README.mdREADME.md

@@ -1,6 +1,6 @@

# videocr -Extract hardcoded subtitles from videos using the [Tesseract](https://github.com/tesseract-ocr/tesseract) OCR engine with Python. +Extract hardcoded (burned-in) subtitles from videos using the [Tesseract](https://github.com/tesseract-ocr/tesseract) OCR engine with Python. Input a video with hardcoded subtitles:

@@ -10,11 +10,16 @@ <img width="430" alt="screenshot" src="https://user-images.githubusercontent.com/10210967/56873659-3b76dd00-6a34-11e9-97aa-2c3e96fe3a97.png">

</p> ```python +# print_sub.py + import videocr -print(videocr.get_subtitles('video.avi', lang='chi_sim+eng', sim_threshold=70)) +if __name__ == '__main__': + print(videocr.get_subtitles('video.avi', lang='chi_sim+eng', sim_threshold=70)) ``` +`$ python3 print_sub.py` + Output: ```

@@ -47,7 +52,6 @@ 5

00:00:18,059 --> 00:00:19,019 谢谢 Laughs Thanks. - ``` ## Performance

@@ -59,7 +63,6 @@

1. Install [Tesseract](https://github.com/tesseract-ocr/tesseract/wiki) and make sure it is in your `$PATH` 2. `$ pip install videocr` - ## API

@@ -83,7 +86,7 @@ ### Parameters

- `lang` - The language of the subtitles in the video. All language codes on [this page](https://github.com/tesseract-ocr/tesseract/wiki/Data-Files#data-files-for-version-400-november-29-2016) (e.g. `'eng'` for English) and all script names in [this repository](https://github.com/tesseract-ocr/tessdata_fast/tree/master/script) (e.g. `'HanS'` for simplified Chinese) are supported. + The language of the subtitles. You can extract subtitles in almost any language. All language codes on [this page](https://github.com/tesseract-ocr/tesseract/wiki/Data-Files#data-files-for-version-400-november-29-2016) (e.g. `'eng'` for English) and all script names in [this repository](https://github.com/tesseract-ocr/tessdata_fast/tree/master/script) (e.g. `'HanS'` for simplified Chinese) are supported. Note that you can use more than one language. For example, `'hin+eng'` means using Hindi and English together for recognition. More details are available in the [Tesseract documentation](https://github.com/tesseract-ocr/tesseract/wiki/Command-Line-Usage#using-multiple-languages).

@@ -108,4 +111,3 @@

- `use_fullframe` By default, only the bottom half of each frame is used for OCR. You can explicitly use the full frame if your subtitles are not within the bottom half of each frame. -