Created
February 28, 2023 16:28
-
-
Save mknz/8fb841b6827f48f8163cf2baed21167e to your computer and use it in GitHub Desktop.
Download YouTube video, extract audio and convert it to whisper-cpp compatible wav
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
WORKDIR=/tmp/whisper | |
rm -rf $WORKDIR | |
mkdir $WORKDIR | |
URL=\'$1\' | |
SAVEFILE=\'$WORKDIR/tmp.3gpp\' | |
python -c "from pytube import YouTube; YouTube($URL).streams.first().download(filename=$SAVEFILE)" | |
ffmpeg -i $WORKDIR/tmp.3gpp -ar 16000 -ac 1 -c:a pcm_s16le $WORKDIR/tmp.wav &> /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment