Language learning application that uses openai's whisper to generate foreign language and English subtitles for videos simultaneously to help with language learning.
> pip install llsubtitles
To use llsubtitles
first you need a foreign language .mp4 file. I recommend using yt-dlp to download content for language learning. Once you have a .mp4 file you can use llsubtitles
to generate subtitles for it.
# Using chinese content for this example
> llsubtitles --task translate,transcribe --language Chinese --model small --combined --definitions --pinyin example.mp4
--task: Refers to the tasks that will be performed by openai's whisper. The options are translate
, transcribe
, and translate,transcribe
. Transcribe will create subtitles in the same language as the source material. Translate will create subtitles in English. Both options are necessary when running with the --combined option.
--language: Refers to the language used by openai's whisper to generate subtitles.
--model: The model used by whisper. See their documentation for more options.
--combined: If this flag is used, the subtitles will be generated in both the foreign language and English.
--definitions: If this flag is used, the subtitles will include definitions for the foreign language words.
--pinyin: Optional flag for Chinese learners, if this flag is used, the subtitles will include pinyin for the Chinese words.
Note, you should make sure that you have pytorch set up correctly to use Cuda if you're using an Nvidia GPU. See pytorch's documentation for more information. This will greatly improve performance.
Chinese English dictionary is courtesy of cedict