Skip to content

Using FFmpeg in Github Codespaces

esmith1729 edited this page Sep 25, 2023 · 4 revisions

Setup Environment

It is assumed that you will be running Whisper.cpp from a GitHub Codespace, following the "Quick Start instructions"

Codespaces are an Ubuntu environment, and so to be able to use FFmpeg, in order to convert audio files into 16 bit WAV files, which is the format that Whisper is expecting, you'll need to first run some Linux commands in your Codespace.

Installing FFmpeg

  • Firstly, run sudo apt update, which will update all of the Ubuntu system packages you will need
  • Second, run sudo apt upgrade
  • Third, run sudo apt install ffmpeg
  • You should then be able to confirm that it installed correctly by running ffmpeg --version
  • Now, you should be able to run both make samples and ffmpeg -i <input>.mp3 -ar 16000 -ac 1 -c:a pcm_s16le <output>.wav, where <input>.mp3 is the input file, and <output>.wav is the name you want to give to the file after processing. You may need to follow the appropriate steps from Whisper.cpp before running these.

Importing Whisper

For some Python files you may have an unresolved import whisper statement, this can be fixed by running pip install -U openai-whisper in the Codespace terminal

Clone this wiki locally