本项目期望使用 openai whisper 与 openai text API 为生肉视频生成字幕。
This project aims to use the OpenAI Whisper and OpenAI Text API to generate subtitles for raw videos.
- An openai API is required.
- Create a file named `openai.keys' and paste your key.
- run the following code to download & transcribe & translate a youtube course :) You Will get a
.srt
output.
from AutoSub.transcribe import transcribe
# Use chatgpt for translation. (recommended)
transcribe("https://www.youtube.com/watch?v=vwHqxe9eVMk&list=PLA5yNsxyt7sC3B4qhj_sMgGWqWWaSerq-", mode='chat')
# Use davinci for translation.
# transcribe("https://www.youtube.com/watch?v=vwHqxe9eVMk&list=PLA5yNsxyt7sC3B4qhj_sMgGWqWWaSerq-", mode='complete')
This project run openai whisper locally to save your wallet. So the cost is solely text API. A typical english class for 1 hour gets around 10K tokens, and 20K for the translation depends on output language. This means 0.06/h USD in 'chat' mode or 0.6 USD in 'complete' mode.
- v1.0 : A stable version for Chinese translation.
- v1.0.1 : Use ffmpeg to merge media.
- v1.0.2 : add multilingual translation support.
- v1.1 : add CLI support.