VideoHelp Forum
+ Reply to Thread
Results 1 to 4 of 4
Thread
  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
    Location
    canada
    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
    Location
    Spain
    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.
    else:
    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"):
    list.append(file[:-3])
    #print(str(list))
    #print(cwd)


    for file in list:
    title = re.search("(.+S\d+E\d+.+)1080", file)
    try:
    title = title.group(1)
    except:
    title = re.search("(.+\d{4})\.1080", file)
    title = title.group(1)
    title = title.replace("."," ")
    print(title)
    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}eng.srt" ")" --title "{title}" --track-order 0:0,0:1,1:0'


    subprocess.run(shlex.split(mycmd))
    print(f"merged subs for {file}\n")

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



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!