antiboredom / videogrep

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

cmu-pocketsphinx failing #87

Closed mroberts1 closed 2 years ago

mroberts1 commented 2 years ago

Videogrep is installed, as well as cmu-pocketsphinx (via brew), but when I run videogrep on a video without subtitles the transcription stage fails (see error below). Pocketsphinx appears to be the culprit - I found multiple threads with install problems on recent versions of MacOS.

Tried installing Python 3.9.10 with pyenv but keep getting the same error, including with the latest Python (3.10) on MacOS Monterey.

videogrep --input ~/Downloads/detectorists-test.mp4 -tr --search "detectorists"            ─╯
chruby: unknown Ruby: 2.7.0
/Users/dokoissho/Downloads/detectorists-test.mp4.temp.wav
1/1 Transcribing /Users/dokoissho/Downloads/detectorists-test.mp4.temp.wav
Traceback (most recent call last):
  File "/usr/local/bin/videogrep", line 5, in <module>
    videogrep.main()
  File "/usr/local/lib/python3.9/site-packages/videogrep/videogrep.py", line 520, in main
    create_timestamps(args.inputfile)
  File "/usr/local/lib/python3.9/site-packages/videogrep/videogrep.py", line 128, in create_timestamps
    audiogrep.transcribe(files)
  File "/usr/local/lib/python3.9/site-packages/audiogrep/audiogrep.py", line 43, in transcribe
    transcript = subprocess.check_output(['pocketsphinx_continuous', '-infile', f, '-time', 'yes', '-logfn', '/dev/null', '-vad_prespeech', str(pre), '-vad_postspeech', str(post)])
  File "/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['pocketsphinx_continuous', '-infile', '/Users/dokoissho/Downloads/detectorists-test.mp4.temp.wav', '-time', 'yes', '-logfn', '/dev/null', '-vad_prespeech', '10', '-vad_postspeech', '50']' returned non-zero exit status 255.
antiboredom commented 2 years ago

hi! this looks like an issue with the way videogrep is calling pocketsphinx. I will take a look...

antiboredom commented 2 years ago

This is now address in the new beta branch (using vosk now instead of pocketsphinx for much better results)