apm1467 / videocr

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

Exception running with python 3.7 #3

Closed HyperTesto closed 4 years ago

HyperTesto commented 5 years ago

Hello, i was trying to run videocr on a test avi file but i ran into this issue:

$ python3.7 test.py 
Exception in thread Thread-3:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.7/multiprocessing/pool.py", line 470, in _handle_results
    task = get()
  File "/usr/lib/python3.7/multiprocessing/connection.py", line 251, in recv
    return _ForkingPickler.loads(buf.getbuffer())
TypeError: __init__() takes 1 positional argument but 2 were given

I'm not a python guy so i don't know where and how to get more information about this. Thank you, this library look very promising!

apm1467 commented 5 years ago

Thank you for trying! May I see the content of test.py? And which OS do you use?

HyperTesto commented 5 years ago

This is the file content:

# print_sub.py

import videocr

if __name__ == '__main__':
    print(videocr.get_subtitles("test.avi", lang='ita', sim_threshold=70, conf_threshold=65))

And this is my OS information:

NAME="Linux Mint"
VERSION="18.2 (Sonya)"
ID=linuxmint
ID_LIKE=ubuntu
PRETTY_NAME="Linux Mint 18.2"
VERSION_ID="18.2"
HOME_URL="http://www.linuxmint.com/"
SUPPORT_URL="http://forums.linuxmint.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/linuxmint/"
VERSION_CODENAME=sonya
UBUNTU_CODENAME=xenial
apm1467 commented 5 years ago

I will run a Linux Mint virtual machine and try to reproduce the bug.

In the mean time, could you convert the video into mp4 format using ffmpeg and try it again?

E.g. $ ffmpeg -i test.avi test.mp4 and then use test.mp4 in print_sub.py. I would like to see if this is a video format problem.

HyperTesto commented 5 years ago

Tried, same result T_T.

sandmars commented 4 years ago

我也遇到同样的错误,我用的是MP4格式的视频。另外,国内是否是必须要梯子才可以用,我发现不挂梯子连接不了

dd01wangzhenzhen commented 4 years ago

需要安装Tesseract,安装方法 https://github.com/tesseract-ocr/tesseract/wiki

udaykumar1506 commented 4 years ago

@apm1467 Any update on this issue, I am facing the same Python version -- 3.7.4 Tesseract version -- 3.04.01

apm1467 commented 4 years ago

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. It is likely a Tesseract installation error.

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

$ pip3 install -U videocr
HyperTesto commented 4 years ago

Hi, i missed the notification on this... I'll try out in the next days. Thanks a lot!