PgsToSrt icon indicating copy to clipboard operation
PgsToSrt copied to clipboard

Bulk Conversion

Open RedSoxFan04 opened this issue 3 years ago • 2 comments

Is it possible to tell PgsToSrt to convert all files in a directory? Does it depend on the container?

RedSoxFan04 avatar Oct 03 '21 05:10 RedSoxFan04

It's not directly possible, but you can create a batch file:

for %%# in (C:\pathtomks\*.mks) do c:\somepath\pgstosrt.exe --input "%%#" --output "%%~dpn#.srt"--trackLanguage eng --otheroptions ...

Tentacule avatar Oct 04 '21 21:10 Tentacule

Here's a bash script for anyone using Linux. This script will save a file named {episode name}.{language}.srt in the same directory as your mkv.

#!/bin/bash
FOLDER=$1
FILES="$(find "$FOLDER" -name '*.mkv' -printf '%p\n')"
while IFS= read -r file;
do
  printf "\nProcessing ${file}\n"
  dotnet PgsToSrt.dll --input "$file" --tracklanguage eng
done <<< "$FILES"

Modify the language to your desired language and save this as a file in the same directory where PgsToSrt.dll is, chmod +x it to make it executable, and run it

./PgsToSrt.sh "/path/to/folder"

Example

NAS>./PgsToSrt.sh "/mnt/media/plex/tv/Eureka (2006)/Season 1"

Processing /mnt/media/plex/tv/Eureka (2006)/Season 1/Eureka - S01E09 - Primal.mkv
PgsToSrt 1.4.1.0

2021/12/11 17:27:04.290|INFO|Detected tesseract language data for language 'eng'.
2021/12/11 17:27:13.922|INFO|Starting OCR for 697 items...
...
2021/12/11 17:27:45.144|INFO|Finished OCR.
2021/12/11 17:27:45.155|INFO|Saved '/mnt/media/plex/tv/Eureka (2006)/Season 1/Eureka - S01E09 - Primal.eng.srt' with 697 items.

bsmithio avatar Dec 11 '21 23:12 bsmithio