A PotPlayer plugin that leverages the ChatGPT API to provide real-time, context-aware subtitle translation. ✨
Works on my machine.
PotPlayer_ChatGPT_Translate is a PotPlayer plugin that integrates the ChatGPT API to deliver real-time, context-aware subtitle translation. Unlike traditional translation tools, this plugin considers context, idioms, and cultural nuances to produce more accurate translations. The core of the project is implemented using AngleScript, leveraging both the ChatGPT API and PotPlayer API for deep integration.
One key advantage of using ChatGPT for subtitle translation is its ability to understand context and cultural references. Compare the following results:
-
Original subtitle:
"You're gonna old yeller my f**king universe."
-
Google Translate Result:
-
ChatGPT Translation Result:
"你要像《老黄犬》一样对待我的宇宙?"
(Correctly captures the reference and intended meaning)
-
Original Subtitle:
"But being one in real life is even better."
-
ChatGPT Translation (Without Context):
"但是,在现实生活中成为一个人甚至更好。"
(Literal translation, failing to capture the implied meaning) -
ChatGPT Translation (With Context):
"但在现实生活中成为一个反派更好。"
(Accurately capturing the intended context)
Click below to watch the tutorial on Bilibili:
- AngleScript – The scripting language used to develop the plugin
- ChatGPT API – Provides context-aware translation capabilities
- PotPlayer API – Enables seamless integration with PotPlayer
- Download the Installer:
Installer
(The installer is open source, so you can review the source code) - Run the Installer:
- Double-click
installer.exe
to start the installation. - The installer automatically detects your PotPlayer installation path and completes the setup.
- Double-click
- Download the ZIP File:
Download the latest ZIP file from this repository. - Extract the ZIP File:
Extract the contents to a temporary folder. - Copy Files:
CopyChatGPTSubtitleTranslate.as
andChatGPTSubtitleTranslate.ico
to the following directory:ReplaceC:\Program Files\DAUM\PotPlayer\Extension\Subtitle\Translate
C:\Program Files\DAUM\PotPlayer
with your custom PotPlayer installation path if necessary.
Sure! Here's the updated README section, with your extended model API list included in English and following the current structure:
-
Open PotPlayer's Preferences:
Press F5 to open the PotPlayer Preferences. -
Navigate to Extensions:
Go to Extensions > Subtitle translation. -
Select the Translation Plugin:
Choose ChatGPT Translate as the translation plugin. -
Configure the Plugin:
-
Model Name:
You can simply enter the model name, which will use the default API URL.
Example:gpt-4o-mini
Alternatively, specify a custom API URL using the following format:
ModelName|API Base URL
Example:
gpt-4o-mini|https://api.openai.com/v1/chat/completions
Note:
In version v1.5 and later, if you're using a self-hosted or third-party API that does not require an API key, you can addnullkey
at the end:gpt-4o-mini|nullkey
or:
qwen2.5:7b|https://127.0.0.1:11434/v1/chat/completions|nullkey
-
API Key:
Enter your API key if needed.You can test your API key using keytest.obanarchy.org to ensure it is valid.
-
-
Set the Source and Target Languages:
Configure the source and target languages as required.
Use the format:
ModelName|API Base URL|nullkey (optional)
Here is a list of supported models:
Deepseek: deepseek-chat|https://api.deepseek.com/v1/chat/completions
Tongyi Qianwen: qwen-plus|https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions
SiliconFlow: siliconflow-chat|https://api.siliconflow.cn/v1/chat/completions
ERNIE Bot (Wenxin Yiyan): ernie-4.0-turbo-8k|https://qianfan.baidubce.com/v2/chat/completions
Gemini: gemini-2.0-flash|https://generativelanguage.googleapis.com/v1beta/openai/chat/completions
ChatGLM: chatglm-6b|https://api.chatglm.cn/v1/chat/completions
LLaMA: llama-13b|https://api.llama.ai/v1/chat/completions
Code LLaMA: code-llama-34b|https://api.llama.ai/v1/code/completions
DeepSeek-V3: deepseek-v3|https://api.deepseek.com/v3/chat/completions
DeepSeek-R1: deepseek-r1|https://api.deepseek.com/r1/chat/completions
Local Deployment (no API key): model-name|127.0.0.1:PORT|nullkey
You can expand or replace these with any OpenAI-compatible model that supports the chat/completions endpoint.
When playing a video with subtitles in PotPlayer, the plugin automatically calls the ChatGPT API to translate the subtitles in real time. By handling context, idioms, and cultural nuances, the plugin provides more accurate translations.
For example:
- Input: "You're gonna old yeller my f**king universe."
- Traditional Translation Tools might output a literal or awkward translation.
- ChatGPT Translation captures the movie reference and context to deliver a more appropriate translation.
- Integrate ChatGPT API with PotPlayer API for real-time subtitle translation.
- Support additional AI models (planned for the future, not imminent).
- Optimize context handling to further improve translation accuracy.
Contributions are welcome! When submitting a pull request, please clearly describe the purpose of your changes.
If you have suggestions for improvements or bug fixes, feel free to open an issue before making modifications.
Distributed under the MIT License. See LICENSE
for more information.
Personal website: obanarchy.org
- Thanks to OpenAI for providing the powerful ChatGPT API.
- Thanks to the PotPlayer team for creating an excellent media player.
- Thanks to everyone who has contributed suggestions or code to improve this project (contributor details will be updated here).
憋个大的awa