SeConv - SubtitleEdit's Command Line Tool BAT Samples


Feuer

Fatal Error
Power User
VIP
Local time
9:17 PM
Posts
331
Location
Türkiye
OS
Windows 11 25H2 Home Single Language (26200.8037)
FIRST OF ALL BACK UP ALL OF YOUR ALL SUBTITLES TO ANOTHER LOCATION
FIRST OF ALL BACK UP ALL OF YOUR ALL SUBTITLES TO ANOTHER LOCATION
FIRST OF ALL BACK UP ALL OF YOUR ALL SUBTITLES TO ANOTHER LOCATION


If you have thousands of subtitles and want to handle their encodings with BAT script, it is the address:

I use SeConv command line tool from SubtitleEdit's creator, it uses same dll libraries.

Go to that address

download the latest SeConv-Windows-x64.zip

extract it, place it.

my BAT files addressed seconv.exe "D:\FLY\SubtitleEdit\seconv.exe"

you have to replace where you hold it. It is important.

and my subtitles are named like
.en.srt for english subtitles
.tr.srt for Turkish subtitles

examples
D:\Subtitles\Hannibal [2013-2015] [3S39E] [TV Series]\S03\Hannibal S03E01 Antipasto.en.srt
D:\Subtitles\Hannibal [2013-2015] [3S39E] [TV Series]\S03\Hannibal S03E01 Antipasto.tr.srt

BAT files will work recursive

SeConv_encoding_report.bat

Code:
@echo off
setlocal EnableExtensions EnableDelayedExpansion

set "SECONV=D:\FLY\SubtitleEdit\seconv.exe"
set "REPORT=%~dp0encoding_report.txt"
set "JSON=%TEMP%\seconv_info.json"

> "%REPORT%" echo SRT ENCODING REPORT
>>"%REPORT%" echo Created: %date% %time%
>>"%REPORT%" echo.
>>"%REPORT%" echo File ^| Encoding
>>"%REPORT%" echo -------------------------------------------------------------------------------

for /r "%~dp0" %%F in (*.srt) do (
    echo Scanning: %%~nxF

    "%SECONV%" info "%%~fF" --json > "%JSON%" 2>nul

    set "ENCODING="

    for /f "delims=" %%A in ('findstr /C:"encoding" "%JSON%"') do (
        set "ENCODING=%%A"
    )

    set "ENCODING=!ENCODING:  "encoding": "=!"
    set "ENCODING=!ENCODING:"encoding": "=!"
    set "ENCODING=!ENCODING:",=!"

    >>"%REPORT%" echo %%~fF ^| !ENCODING!
)

del "%JSON%" 2>nul

echo.
echo Done.
echo Report: "%REPORT%"


set "INPUT=%~dp0encoding_report.txt"

set "TEMP_EN=srt_temp_en.txt"
set "TEMP_TR=srt_temp_tr.txt"

set "OUTPUT_EN=different_en.txt"
set "OUTPUT_TR=different_tr.txt"

findstr /i /l ".en.srt" "%INPUT%" > "%TEMP_EN%"
findstr /i /v /l /c:"utf-8 (with BOM)" "%TEMP_EN%" > "%OUTPUT_EN%"

findstr /i /l ".tr.srt" "%INPUT%" > "%TEMP_TR%"
findstr /i /v /l /c:"windows-1254" "%TEMP_TR%" > "%OUTPUT_TR%"

del "%TEMP_EN%" 2>nul
del "%TEMP_TR%" 2>nul


pause

That script will give you encoding_report.txt and different_en.txt & different_tr.txt

encoding_report.txt
: list all .srt files with complete path and their encoding the output will be like
D:\Subtitles\A Knight of the Seven Kingdoms [2026] [1S6E] [TV Series]\S01\A Knight of the Seven Kingdoms S01E01 720p x264-FENiX.en.srt | utf-8 (with BOM)
D:\Subtitles\A Knight of the Seven Kingdoms [2026] [1S6E] [TV Series]\S01\A Knight of the Seven Kingdoms S01E01 720p x264-FENiX.tr.srt | windows-1254

different_en.txt list all *.en.srt files that different encoding than utf-8 (with BOM)

example:
D:\Subtitles\Blade Marvel Anime [2011] [1S12E] [Animated Series]\S01\BLADE (2011) - Ep. 01 - Blade, the Man (480p DVDRip - DUAL Audio).en.srt | windows-1258
D:\Subtitles\Blade Marvel Anime [2011] [1S12E] [Animated Series]\S01\BLADE (2011) - Ep. 05 - The Glowing Island (480p DVDRip - DUAL Audio).en.srt | windows-1252

different_tr.txt list all *.tr.srt files that different encoding than windows-1254

SeConv_encode_different_en_to_utf-8.bat this BAT will convert listed .srt files in different_en.txt to utf-8 (with BOM)
Code:
@echo off
setlocal EnableExtensions EnableDelayedExpansion

set "SECONV=D:\FLY\SubtitleEdit\seconv.exe"

for /f "usebackq delims=|" %%F in ("different_en.txt") do (
    set "FILE=%%F"
    set "FILE=!FILE:~0,-1!"

    echo Converting: !FILE!
    "%SECONV%" "!FILE!" subrip --encoding:utf-8 --overwrite
)

echo.
echo All files converted.
pause

SeConv_encode_different_tr_to_windows-1254.bat this BAT will convert listed .srt files in different_tr.txt to windows-1254
Code:
@echo off
setlocal EnableExtensions EnableDelayedExpansion

set "SECONV=D:\FLY\SubtitleEdit\seconv.exe"

for /f "usebackq delims=|" %%F in ("different_tr.txt") do (
    set "FILE=%%F"
    set "FILE=!FILE:~0,-1!"

    echo Converting: !FILE!
    "%SECONV%" "!FILE!" subrip --encoding:windows-1254 --overwrite
)

echo.
echo All files converted.
pause

You can modify that BAT files according to your naming and encoding shape
 

My Computer My Computer

At a glance

Windows 11 25H2 Home Single Language (26200.8...Intel Core i3-1115G48GBon-board
OS
Windows 11 25H2 Home Single Language (26200.8037)
Computer type
Laptop
Manufacturer/Model
LENOVO IdeaPad 5 15ITL05
CPU
Intel Core i3-1115G4
Motherboard
There is no such a God, I only know mother-Earth
Memory
8GB
Graphics Card(s)
on-board
Sound Card
on-board
Monitor(s) Displays
(s) is too ambitious for me
Screen Resolution
1920*1080
Hard Drives
256GB (SSD)
PSU
I was very young when I last saw a PSU
Case
...
Cooling
My coldness is enough to cool the computer
Keyboard
A broken and very clean keyboard
Mouse
Rat
Internet Speed
Slowest internet connection in Europe
Browser
ChromePortable / FirefoxPortable / TorBrowser
Antivirus
G-Virus
Other Info
I can simply say that I took the red pill and I am not happy with it.
Back
Top Bottom