VideoHelp Forum

+ Reply to Thread
Results 1 to 4 of 4
Thread
  1. 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.
    Quote Quote  
  2. 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
    Quote Quote  
  3. 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
    Step 16 Run the code, and you're done!

    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.
    Quote Quote  
  4. wow great find...bookmarked it..I use linux so shouldn't be too hard to figure out...thx for the info and find seanmcnally
    Quote Quote