125 points · by eigenvalue · 3y ago · 43 comments
It's truly easy to use-- you can clone the repo, install to a venv, and be generating a folder full of high quality transcript text files in under 5 minutes. All you need to do is supply the URL to a YouTube playlist or to an individual video file and this tool does the rest automatically. It uses faster-whisper with a high beam_size, so it's a bit slower than you might expect, but this does result in higher accuracy. The best way to use this is to take an existing playlist, or create a new one on YouTube, start this script up, and come back the next morning with all your finished transcripts. It attempts to "upgrade" the output of whisper by taking all the transcript segments, gluing them together, and then splitting them back into sentences (it uses Spacy for this, or a simpler regex-based function). You end up with a single text file with the full transcript all ready to go for each video in the playlist, with a sensible file name based on the title of the video.
If you have CUDA installed, it will try to use it, but as with all things CUDA, it's annoyingly fragile and picky, so don't be surprised if you get a CUDA error even if you know for a fact CUDA is installed on your system. If you're looking for reliability, disable CUDA. But if you need to transcribe a LOT of transcripts, it does go much, much faster on a GPU.
Even if you don't have a GPU, if you have a powerful machine with a lot of RAM and cores, this script will fully saturate them and can download and process multiple videos at the same time. The default settings are pretty good for that situation. But if you have a slower machine, you might want to use a smaller Whisper model (like `base.en` or even `tiny.en`) and dial down the beam_size to 2.
It makes a great difference to have transcripts with speaker annotation.
I wanted to keep my script lighter weight and also GPU optional (i.e., a GPU will work and make it faster, but it also works acceptably with just the CPU). I really feel in my gut that the speaker diarization doesn't need to be so complicated or hard once you already have the accurate timestamps of each transcribed segment and the underlying audio file-- no reason why it shouldn't be able to run fine on a CPU and get good enough accuracy.
Founder of Gladia shares some information on twitter, and i think there's some research papers you can find through that (my memory is fuzzy on when). IT's not a simple problem, especially when words include space fillers like "umm" etc.
For me main use for such cases would be podcast. sometimes i just want to read them without listening.
As someone looking for this functionality, this is the easiest part for me to do manually. Just give me "Speaker A, Speaker B, Speaker C", and I can change their names. It's the breaking apart of audio into separate speakers that's difficult - I'm trying out a few different tools, and none of them do a great job so far.
This is also why I decided to create https://www.betterwhisperapi.com/ . I believe most of the companies are charging pretty insane amounts for transcriptions...
If this was around at the time, we likely would have been able to make audio work.
Kudos for your work on this. Seems truly well architected and thought out. The spacy integration is especially awesome.
Edit: Ah just understood your question (coffee just kicked in). Yes, they're precomputed from when others used it. I save the generated articles in markdown format and sort by most recently generated.
I can confirm for some types of lectures this is a wholly legitimate approach.
I just don't know but am willing to try. I'd rather ask here than be subjected to a search and its SEO hell (read: SERPs of questionable results).
Or perhaps there's a way to use Digial Ocean or similar so I'm not tying up my local machine?
https://www.anaconda.com/download
For windows or Mac. If you do it on Windows it’s probably easier if you let it add it to your Windows system path. Then you should be able to open PowerShell and type “python” and not get an error. Once you can do that, just run these commands on Windows:
git clone https://github.com/Dicklesworthstone/bulk_transcribe_youtube_videos_from_playlist
cd bulk_transcribe_youtube_videos_from_playlist
python -m venv venv
cd venv
.\Scripts\activate
python -m pip install --upgrade pip
python -m pip install wheel
cd ..
pip install -r requirements.txt
Then edit the file " bulk_transcribe_youtube_videos_from_playlist.py" to modify the URL (if you want a playlist, edit that URL and change the `convert_single_video = 1` part to be 0 instead) and finally run it with: python bulk_transcribe_youtube_videos_from_playlist.pyHave you thought about spinning this together as a Chrome extension?
Seems obvious, right?
We've been looking at whisper to replace AWS transcribe. It could be that AWS will just roll whisper in as an engine at some point before we get around to it.
English is my second language, and I mumble.
https://github.com/Dicklesworthstone/youtube_transcript_clea...
Now that I think about it, this would work equally well for the transcripts generated by my new tool. I should just include that html file in my new repo as an added feature.