Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
need help
#21
Yui_18 Wrote:OSError: Can not open video Bhakta Dhruva.mp4.
(Nov-22-2020, 09:55 PM)snippsat Wrote: Use example.py most be in same folder as Bhakta Dhruva.mp4.
Reply
#22
I don't quite understand, both files are already in the same folder?
https://prnt.sc/vogwmk
Do I have to convert the mp4 file to avi or something in order to work?
Reply
#23
Quick test as i have already installed this in a virtual environment.
File used Shiv ki mahima ki katha.mp4 as test.
# example.py

from videocr import get_subtitles

if __name__ == '__main__':  # This check is mandatory for Windows.
    print(get_subtitles('Shiv ki mahima ki katha.mp4', lang='eng', sim_threshold=70, conf_threshold=65))
Python version and files
(my_env) G:\code\my_env
λ python -V
Python 3.8.3

(my_env) G:\code\my_env
λ ls
Include/  Scripts/                       example.py   python_Levenshtein-0.12.0-cp38-cp38-win_amd64.whl
Lib/      'Shiv ki mahima ki katha.mp4'  ffmpeg.exe*  pyvenv.cfg
Run take long time,but work.
(my_env) G:\code\my_env
λ python example.py
Output:
0 00:00:00,000 --> 00:00:01,434 I ly this much that I wish to see you, Bholenath” 1 00:00:01,468 --> 00:00:01,468 — Se I 2 00:00:01,534 --> 00:00:37,337 this much I wish to see you, Bholenath” 3 00:00:51,518 --> 00:00:53,787 Yamraj!- Lord Bholenath! 4 00:00:55,388 --> 00:00:55,855 low did you dare devotee dedicated 5 00:00:55,989 --> 00:00:55,989 fee 6 00:00:56,022 --> 00:01:01,761 4 How did you dare to attack a I devotee dedicated in worship? 7 00:01:01,795 --> 00:01:01,795 J 8 00:01:02,195 --> 00:01:08,568 / This boy had embraced a shivling and come under my, surrender...
Reply
#24
I tried running the python script itself and I get
TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more information.
How to add Tesseract to PATH?
Reply
#25
videocr Wrote:Installation
Install Tesseract and make sure it is in your $PATH
Install:
Tesseract at UB Mannheim

Add to Path:
Environment Variables Path
Reply
#26
opened python, typed & this is what I got, should I run the code in python or Pip(cmd) or should I run the script itself (which opens in python)?

>>> # example.py
>>>
>>> from videocr import get_subtitles
>>>
>>> if __name__ == '__main__': # This check is mandatory for Windows.
... print(get_subtitles('Shiv ki mahima ki katha.mp4', lang='eng', sim_threshold=70, conf_threshold=65))
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\videocr\api.py", line 10, in get_subtitles
v = Video(video_path)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\videocr\video.py", line 26, in __init__
with Capture(path) as v:
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\videocr\opencv_adapter.py", line 11, in __enter__
raise IOError('Can not open video {}.'.format(self.path))
OSError: Can not open video Shiv ki mahima ki katha.mp4.
Reply
#27
Now you run in interactive shell,you most run this a script from command line.
When run like this Path to .mp4 can be wrong if just start python or IDLE and do this.
Look at this for make a .py file in IDLE.
This is a struggle because all this basic stuff is new to you Doh
Reply
#28
Thanks, I have got it.
But it sure is slow! Huh
in my i5 processor, OCR'ing 7 secs of video took exactly 7 mins.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020