TheBookKnight / Python-Fragments

Python scripts based on what I found on the internet
0 stars 0 forks source link

Transcribe Videos (with 97% accuracy) #8

Closed TheBookKnight closed 8 months ago

TheBookKnight commented 8 months ago

Medium blog: Transcribing videos with 97% accuracy

Some interesting relevant info BLOG: OpenAI - Whisper API

OpenAI Whisper docs

TheBookKnight commented 8 months ago

After installing python libraries and running the script, I got the following error

Video to Audio to Transcript % pipenv run python mp4_to_wav_to_transcription.py 
/Users/macpro/.local/share/virtualenvs/Video_to_Audio_to_Transcript-39_ghuIH/lib/python3.12/site-packages/pydub/utils.py:170: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work
  warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)
Enter the mp4 file name: rossjeffries.mp4
/Users/macpro/.local/share/virtualenvs/Video_to_Audio_to_Transcript-39_ghuIH/lib/python3.12/site-packages/pydub/utils.py:198: RuntimeWarning: Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work
  warn("Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work", RuntimeWarning)
Traceback (most recent call last):
  File "/Users/macpro/Documents/GitHub/Python-Fragments/Video to Audio to Transcript/mp4_to_wav_to_transcription.py", line 9, in <module>
    video = AudioSegment.from_file(filename)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/macpro/.local/share/virtualenvs/Video_to_Audio_to_Transcript-39_ghuIH/lib/python3.12/site-packages/pydub/audio_segment.py", line 728, in from_file
    info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/macpro/.local/share/virtualenvs/Video_to_Audio_to_Transcript-39_ghuIH/lib/python3.12/site-packages/pydub/utils.py", line 274, in mediainfo_json
    res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 1950, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'ffprobe'