This is just a small sideproject. It does not include any best practice and is more a proof of concept than something really useful. If you can make it or fork it into something useful, feel free to do so
YTSubs is a web application that allows users to generate subtitles from YouTube videos using Client side loaded models from transformers.js
Warning
As of October 2024, global WebGPU support is around 70% (according to caniuse.com), meaning some users may not be able to use the API.
If the following demos do not work in your browser, you may need to enable it using a feature flag:
- Experimental running on WebGPU from transformers v3
- Generate subtitles from YouTube videos using client side ai
- Process videos up to 20 minutes long
- Transcribes multiple languages
- Streaming transcription progress updates
- Download subtitles in SRT format
- Fully client-side processing
- Nuxt.js 3 - Vue.js framework
- Tailwind CSS - Utility-first CSS framework
- Hugging Face Transformers - State-of-the-art Natural Language Processing
- Web Workers - For background processing
- PostHog - Open-source product analytics
- Node.js (v14 or later)
- pnpm
-
Clone the repository:
git clone https://github.com/ThomasWT/YTSubs.git cd ytsubs
-
Install dependencies:
pnpm install
-
Create a
.env
file in the root directory and add the following variables:# Hosted domain DOMAIN=your_domain # Path to store mp3 files that needs to be converted to .wav PATH_TO_STORE_TEMP_FILES=path_to_temp_files # Public download path PATH_TO_DOWNLOAD_FILES=path_to_download_files
-
Run the development server:
pnpm run dev
-
Open
http://localhost:3000
in your browser to see the application.
- Enter a YouTube URL in the input field.
- Select the language of the video.
- Click "Transcribe" to start the process.
- Wait for the transcription to complete.
- Download the SRT file with the extracted subtitles.
Contributions are welcome! Please feel free to submit a Pull Request.
- Whisper - The AI model powering our transcription
- Transformers.js - For running Whisper models in the browser
- ytdl-mp3. - For YouTube audio extraction
Twitter - @eothica
Project Link: https://github.com/ThomasWT/caption-youtube