Live data from Hacker News

Show HN: Bulk Creation of Transcripts from YouTube Playlists with Whisper

github.com

1–10 of 45 posts

Show HN: Bulk Creation of Transcripts from YouTube Playlists with Whisper

#1
I know there are various tools that are supposed to make this easy, but I couldn't find anything that did everything I wanted, so I made this today for fun. The web-based offerings all take forever and seem flaky, and you need to process one video at a time, with no control over the transcription settings. In contrast, my script lets you convert a whole playlist in bulk with full control over everything.

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.

Show HN: Bulk Creation of Transcripts from YouTube Playlists with Whisper
github.com

Re: Show HN: Bulk Creation of Transcripts from YouTube Playlists with Whisper

#2
This is awesome man. We attempted to build something similar and wound up giving up and pivoting to transcripts w/ a punctuation model to enhance them.

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.

Re: Show HN: Bulk Creation of Transcripts from YouTube Playlists with Whisper

#3

This is awesome man. We attempted to build something similar and wound up giving up and pivoting to transcripts w/ a punctuation model to enhance them. 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.

Thanks! I spent a decent amount of time messing around with regex nonsense before I realized Spacy could work for this. I decided to leave the regex approach in as an option anyway since it still works reasonably well and is lighter weight.

Re: Show HN: Bulk Creation of Transcripts from YouTube Playlists with Whisper

#5
post #4

You might want to look into diarization also http://gladia.io/ seem to be doing it well. It makes a great difference to have transcripts with speaker annotation.

Thanks, I haven’t seen an easy and reliable way to do this using open source stuff yet. Theoretically just separating out speakers seems like it wouldn’t be that hard; just compute a bunch of FFTs to arrive at a sort of frequency-based “voice fingerprint” for each speaker and then use something like XGboost to match up the audio for each second to one of the speakers. The problem is then what do you with that information? Turning those abstract speaker identifications into actual names would seem to require a fair bit of intelligence and picking up from contextual clues (like if the speaker identifies themselves or introduces another person by name). Anyway, I’ll look into it more. If it could be done reliably without overly complicating the setup, I agree that it would be useful.

Re: Show HN: Bulk Creation of Transcripts from YouTube Playlists with Whisper

#6
post #4

You might want to look into diarization also http://gladia.io/ seem to be doing it well. It makes a great difference to have transcripts with speaker annotation.

Thanks, I haven’t seen an easy and reliable way to do this using open source stuff yet. Theoretically just separating out speakers seems like it wouldn’t be that hard; just compute a bunch of FFTs to arrive at a sort of frequency-based “voice fingerprint” for each speaker and then use something like XGboost to match up the audio for each second to one of the speakers. The problem is then what do you with that informa…

That part can be user input, if it needs to be. Sort of like post processing.

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.

Re: Show HN: Bulk Creation of Transcripts from YouTube Playlists with Whisper

#7
post #4

You might want to look into diarization also http://gladia.io/ seem to be doing it well. It makes a great difference to have transcripts with speaker annotation.

Thanks, I haven’t seen an easy and reliable way to do this using open source stuff yet. Theoretically just separating out speakers seems like it wouldn’t be that hard; just compute a bunch of FFTs to arrive at a sort of frequency-based “voice fingerprint” for each speaker and then use something like XGboost to match up the audio for each second to one of the speakers. The problem is then what do you with that informa…

I built it for our podcast, I'm sure you can re-use it for YT as a source rather than raw audio file: https://github.com/FanaHOVA/smol-podcaster
Post reply on HN