apm1467 / videocr

Extract hardcoded subtitles from videos using machine learning
MIT License
506 stars 117 forks source link

TypeError: 'NoneType' object is not subscriptable #9

Closed RaXorX closed 4 years ago

RaXorX commented 4 years ago

https://pastebin.com/VRnxwxpQ

OS: Windows 10 x64 Python: 3.8 Videocr: 0.1.4 fuzzywuzzy: 0.17.0 Pillow: 6.2.1 pytesseract: 0.3.0 python-Levenshtein-wheels: 0.13.1 opencv-python: 4.1.2

All of the modules are latest, for python 3.8 and x64 architecture. OpenCV wasn't available for py3.8 and had to download it from here http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv python-Levenshtein-wheels Video OCR downloads an old version of this module dating back from 2014 which didn't install for me apparently. For this reason, I installed the newer version and then removed the requirement for the module within Video OCR setup.py

Apparently, the module requirement states it as >=0.12.0 but it still downloads the old version. I'm guessing this is the reason I am having the error above, I might be wrong though since the error seems to be related to OpenCV.

Edit: Here's the code in my file. `# print_sub.py

import videocr if name == 'main': videocr.get_subtitles("sample.mp4", lang='chi_sim', time_start='0:00', time_end='', conf_threshold=65, sim_threshold=90, use_fullframe=False)`

RaXorX commented 4 years ago

I solved it after having to resort to using fullframe as true. Apparently, it was not getting anything with half the frame. Although I am not sure why, even with it at false it was actually extracting the images normally.

When it is at false I get the above error. When I set it at true I get a new error "Unsupported image object"

This is my observation. I saw the images in the temp folder that were being extracted. And they were all in PNG format. Apparently, when it gets to that error it deletes all of the images leaving blank files. I am not sure if that's supposed to happen or not.

5OCmv.png 5OExd.png 5OWRE.png
apm1467 commented 4 years ago

Thank you very much for the report. The problem is now fixed.

Some exception occurred when applying OCR to video frames. Since the OCR runs in a multiprocessing pool, the exception was muted locally in the worker process and the user couldn't get any useful error message.

Now the actual exception message will be printed to stderr.

Sorry for my late reply. Please try the new version 0.1.6:

$ pip3 install -U videocr
dausruddin commented 4 years ago

I still can reproduce this issue on my Ubuntu 20.04.

dausruddin commented 3 years ago

@apm1467 pinging you as I can still produce the error.