Necesitas tener instalado Python 3.9 e instalar la dependencia de Whisper y PyTube:
pip install git+https://github.com/openai/whisper.git
pip install pytube
También necesitas tener instalado ffmpeg
. Según tu sistema operativo se instala de esta forma:
# Ubuntu
sudo apt update && sudo apt install ffmpeg
# Arch Linux
sudo pacman -S ffmpeg
# MacOS con Homebrew (https://brew.sh/)
brew install ffmpeg
# Windows con Chocolatey (https://chocolatey.org/)
choco install ffmpeg
# Windows con Scoop (https://scoop.sh/)
scoop install ffmpeg
Necesitas indicar la URL del vídeo de YouTube que quieres transcribir:
python3 transcript.py -h
python3 transcript.py --video "https://www.youtube.com/watch?v=oHrjAbDanpw"
# también puedes indicar el modelo de IA que usará Whisper
# cuanto más grande, más tardará en descargarlo la primera vez
python3 transcript.py --video "https://www.youtube.com/watch?v=oHrjAbDanpw" --model "large"
Pueden ejecutar el código rápidamente desde este Colab que hice:![Open In Colab](https://camo.githubusercontent.com/f5e0d0538a9c2972b5d413e0ace04cecd8efd828d133133933dfffec282a4e1b/68747470733a2f2f636f6c61622e72657365617263682e676f6f676c652e636f6d2f6173736574732f636f6c61622d62616467652e737667)