Skip to content

Latest commit

 

History

History
110 lines (74 loc) · 3.37 KB

File metadata and controls

110 lines (74 loc) · 3.37 KB

PotPlayer Subtitle Auto Translate

Watch videos and subtitle files around PotPlayer:

  • watch-video-transcribe.ps1 watches downloaded videos and pre-generates .srt subtitles through PotPlayer's bundled Faster-Whisper-XXL engine.
  • watch-subtitle-translate.ps1 watches subtitle files generated by PotPlayer/Whisper and translates them offline through an OpenAI-compatible chat completions API.

The tool is meant for the workflow where PotPlayer first generates a normal subtitle file, such as movie.srt, and this watcher then creates:

  • movie.zh-CN.srt: translated subtitle
  • movie.bilingual.srt: original + translated subtitle

Playback uses normal local subtitle files, so it does not wait for real-time model responses.

Features

  • Watches folders for new .srt, .vtt, and .ass subtitle files
  • Watches folders for new video files and generates same-name .srt files before playback
  • Batches subtitle cues to reduce API calls
  • Keeps a local cache so unchanged subtitles are not translated again
  • Writes pure translated and bilingual subtitle files
  • Can run once for a single file or run continuously in the background
  • Includes a Windows startup installer based on Task Scheduler

Install Subtitle Translation

  1. Copy config.example.json to a private config path, for example:

    $dir = Join-Path $env:APPDATA "PotPlayerSubtitleAutoTranslate"
    New-Item -ItemType Directory -Force -Path $dir
    Copy-Item .\config.example.json (Join-Path $dir "config.json")
  2. Edit config.json and set:

    • apiBaseUrl
    • apiKey
    • model
    • watchDirs
  3. Install startup task:

    .\install-startup.ps1
  4. Start immediately without rebooting:

.\watch-subtitle-translate.ps1


## Install Video Transcription

1. Copy `transcribe-config.example.json` to a private config path, for example:

   ```powershell
   $dir = Join-Path $env:APPDATA "PotPlayerSubtitleAutoTranscribe"
   New-Item -ItemType Directory -Force -Path $dir
   Copy-Item .\transcribe-config.example.json (Join-Path $dir "config.json")
  1. Edit config.json and set:

    • whisperExe
    • model
    • modelDir
    • watchDirs
  2. Install startup task:

    .\install-transcribe-startup.ps1
  3. Start immediately without rebooting:

    .\watch-video-transcribe.ps1

Translate One File

.\watch-subtitle-translate.ps1 -Once "D:\Videos\movie.srt"

Transcribe One Video

.\watch-video-transcribe.ps1 -Once "D:\Videos\movie.mkv"

Configuration

watchDirs should include the folders where PotPlayer saves generated subtitles. PotPlayer's newer Whisper feature can save generated subtitles beside the media file, so add your video library folders if needed.

Set translateExistingOnStart to true only if you want the watcher to translate already existing subtitle files when it first starts. Otherwise it will watch for new or modified files.

For video transcription, stableSeconds controls how long a video file must remain unchanged before Faster-Whisper-XXL starts. This helps avoid transcribing a file that is still downloading.

Secrets are intentionally not stored in this repository. Keep your real config.json outside Git or in an ignored local file.

Uninstall Startup Task

.\uninstall-startup.ps1
.\uninstall-transcribe-startup.ps1