I’ve got a load of files that look like this
subpart1.srt
subpart2.srt
I’m trying to write a batch script that will take the two and merge them, the way that SubtitleEdit can do using the GUI, without changing any of the times. Yes, I know that sounds silly, but in my particular use case, subpart2.srt is already delayed to account for where subpart1.srt ends, and is blank at the beginning.
Can anyone point me towards a good subtitle editor that can join SRTs via command line interface? Preferably on windows. Thanks.
+ Reply to Thread
Results 1 to 5 of 5
-
-
not sure but command line tools look at Video Updater Tools (2017) but possibly has what you're looking for
https://www.videohelp.com/software/Video-Updater-Tools -
Thanks mrbass, I don't believe that software has what I'm looking for, but after a day of research, I've solved this problem myself.
Subedit is a unix-based software that can do what I need, and I figured out the process for getting this to work on Windows 10. Obviously, this will be a lot easier if you're using Linux, but here are the Windows instructions:
Step 1 Open powershell, type wsl --install
Step 2 Go to aka.ms/wslstore, and install Ubuntu from the Microsoft Store
Step 3 Press Launch from the Microsoft Store, let it install the rest of the way.
Step 4: Ubuntu Command Line will prompt you to create a username and password. Note: when making a username, no capital letters are allowed.
Step 5 Still inside Ubuntu Command Line, type sudo apt-get install dos2unix, then type your password
Step 6 Type sudo apt-get install uchardet
Step 7 Close the Ubuntu Command Line Window
Step 8 Go to https://github.com/helixarch/subedit, press the green Code button then Download Zip
Step 9 Extract the zip
Step 10 Navigate inside subedit-master folder with all the bash files (you should see LICENSE, README.md, etc). Shift+Right Click inside that folder, click Open Powershell Window Here
Step 11 Type bash subedit and you should see "Try subedit -h for more information." If you see this, everything you've done so far has worked successfully.
Step 12 Now, copy the extensionless "subedit" file to a directory with all your srt files labeled "moviea_part1.srt" "moviea_part2.srt"
Step 13 Basically, you're going to now create a .bat file that will utilize the subedit -j command to join the two together.
Step 14 Right click, create a new text document, rename to process.bat or something similar (google enabling extensions for known files if you don't see the .txt extension)
Step 15 Edit the file, paste this code into there
Code:@echo off setlocal enabledelayedexpansion mkdir originals mkdir output For %%A in (*.srt) DO ( echo Processing subs for %%A for /F "tokens=1,* delims=_" %%G in ("%%~A") DO ( set moviename=%%G ) bash subedit -i !moviename!_part1.srt -j !moviename!_part2.srt move !moviename!_part1.srt originals move !moviename!_part2.srt originals move !moviename!_part1_join.srt output ) pause
NOTE 1: This script expects SRT files that have names ending with _part1.srt and _part2.srt.
Anything before that must not include any underscores. If your file names have underscores, change the character under "delims" to something like a period, and instead name your file .part1.srt and .part2.srt.
NOTE 2: The originals will be moved to a new folder called "originals", and the newly joined files will be moved to a folder called "output".
NOTE 3: This only works with two-part files. If you have a third part, grab the "joined" file from the output folder, put it back in the working directory, rename it to moviename_part1.srt, and then rename your third part to moviename_part2.srt. -
wow great find...bookmarked it..I use linux so shouldn't be too hard to figure out...thx for the info and find seanmcnally
-
thanks for this but didn't work
Code:A subdirectory or file originals already exists. A subdirectory or file output already exists. Processing subs for moviea_part1.srt subedit: line 787: moviea_part2.srt: Permission denied sed: preserving permissions for ‘./sedSbDLKD’: Operation not permitted sed: cannot rename ./sedSbDLKD: Permission denied Warning: "moviea_part2.srt.bak" is not readable Error: "moviea_part2.srt" is not a valid srt file 1 file(s) moved. 1 file(s) moved. The system cannot find the file specified. Press any key to continue . . .
Similar Threads
-
MKVMERGE Batch Muxing multiple audio and subtitle tracks?
By jahob000 in forum Newbie / General discussionsReplies: 38Last Post: 30th May 2023, 19:13 -
Batch splitting many video files into smaller parts
By manav in forum EditingReplies: 4Last Post: 27th Aug 2020, 17:26 -
How to join batch video files?
By iKron in forum Video ConversionReplies: 7Last Post: 9th Sep 2018, 13:19 -
How to batch translate multiple SRT files
By demowolf in forum SubtitleReplies: 2Last Post: 22nd Jun 2018, 00:02 -
Batch embed .SRT files in MP4 container
By baglio in forum MacReplies: 12Last Post: 23rd Dec 2017, 03:24