VideoHelp Forum

+ Reply to Thread
Results 1 to 4 of 4
  1. I have a folder of .srt files that are not synced correctly with the RAWs of a TV series, as those RAWs don't include the opening. If it was a single file what I'd do would be using the Aegisub's Times Shift option to to increase/decrease the subtitle's starting and ending position with a given length (in this case I need to "delay" every subtitle by 2 minutes and 56 seconds). However I need to do this for 49 files but I don't know a way to bulk edit all the files.
    Quote Quote  
  2. I'm a Super Moderator johns0's Avatar
    Join Date
    Jun 2002
    Search Comp PM
    Open subtitle edit/tools/batch convert/offset time codes then drag the folder into batch convert.
    I think,therefore i am a hamster.
    Quote Quote  
  3. Thanks a lot!
    Quote Quote  
  4. Member
    Join Date
    Dec 2021
    Search Comp PM
    i do this with python script and subtitleedit...
    This edits and remerges english srt subs for all mkv files in a folder.

    import os
    import subprocess, shlex
    import re

    #LOCATION OF APPS/binaries
    subtitleedit = "C:\Program Files\Subtitle Edit\SubtitleEdit.exe"
    directory= "C:/Program Files/MKVToolNix/mkvmerge.exe"

    #get directory, files
    cwd = os.getcwd()
    files = os.listdir()

    for file in files:
    print(f"converting {file}")
    if "E01" in file or "E02" in file or "E03" in file: #I had situation where some episodes needed different offsets, and i had manually specified it, this isnt really critical.
    os.system(f'"{subtitleedit}" /convert {cwd}/{file} srt /offset:-00:00:10:00') #-00:00:10:00 here sets the subtitles 10 seconds earlier.
    os.system(f'"{subtitleedit}" /convert {cwd}/{file} srt /offset:-00:00:10:00')
    print("conversion complete\n")

    #remerge fsubs into file
    files = os.listdir()
    cwd = os.getcwd()
    list = []
    for file in files:
    if file.endswith(".mkv"):

    for file in list:
    title ="(.+S\d+E\d+.+)1080", file)
    title =
    title ="(.+\d{4})\.1080", file)
    title =
    title = title.replace("."," ")
    print(f"remerging subs for {file}")
    mycmd = f'"{directory}" --ui-language en --priority lower --output "{cwd}/o{file}mkv" --no-subtitles --language 0:en --display-dimensions 0:1920x1080 --language 1:en "(" "{cwd}/{file}mkv" ")" --language 0:en --track-name 0:English --default-track-flag 0:no --track-enabled-flag 0:no "(" "{cwd}/{file}" ")" --title "{title}" --track-order 0:0,0:1,1:0'
    print(f"merged subs for {file}\n")

    if os.path.exists(f"{cwd}/o{file}mkv"):
    print("removing old files")
    print("renaming new file")
    os.rename(f"{cwd}/o{file}mkv", f"{cwd}/{file}mkv")
    Quote Quote  

Similar Threads