antiboredom / videogrep

automatic video supercuts with python
https://antiboredom.github.io/videogrep
Other
3.33k stars 257 forks source link

running transcribe gives data['result'] keyerror #93

Closed chrisgloom closed 2 years ago

chrisgloom commented 2 years ago

Ran into this just now

 videogrep --input USNavyAdventure.mp4 --transcribe
Transcribing USNavyAdventure.mp4
Traceback (most recent call last):
  File "/usr/local/bin/videogrep", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/videogrep/cli.py", line 129, in main
    transcribe.transcribe(f, args.model)
  File "/usr/local/lib/python3.9/site-packages/videogrep/transcribe.py", line 70, in transcribe
    words = [w for w in data["result"]]
KeyError: 'result'

python3 --version Python 3.9.13

pip3 --version pip 22.1 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)

vosk version vosk-0.3.32

ffmpeg -v ffmpeg version 5.0.1

running on a mac osx 10.15.7

antiboredom commented 2 years ago

I believe this is caused by videogrep either not being able to find the file, or the transcription returning empty results. I've update the code to provide error messages, and will push my changes to pypi later today. In the meantime, can you try with another file?

chrisgloom commented 2 years ago

Same error with another file. My hunch is the transcription returning empty which might be the result of a weird vosk thing going on?

antiboredom commented 2 years ago

weird! can you send over one of the files?

chrisgloom commented 2 years ago

uhhh oops. Incoming me feeling like an idiot...playing the files they have no sound. I didn't notice the yt-dlp format I'd chosen was video only until just now. Thanks for your help—maybe in the future the error will be less opaque by virtue of the added logging haha.