VideoHelp Forum




+ Reply to Thread
Results 1 to 7 of 7
  1. Member
    Join Date
    Dec 2005
    Location
    Canada
    Search Comp PM
    alass application:
    https://github.com/kaegi/alass

    related Videohelp post:
    https://forum.videohelp.com/threads/409007-Reporting-on-subtitle-quality#post2684596



    I'm using alass to sync subtitles and trying to create a bat file that scans a folder of video files that also contain a list of the out-of-sync subtitles (same names as the videos).
    The bat file should analyse the .srt files in sequence and output a synced subtitle with the same name as the unsynced.srt file folder.
    The command prompt for a single video/sub works fine.

    Code:
    alass.bat "xmas special.mkv" "xmas special.srt" new.srt.

    Assume the folder has 9 videos/srt files, sync the first file then move to second file, etc

    The following line supposed to step through the list
    Code:
    for %%x in (1, 1, 9) do sync.bat "%%x.mkv" "%%x.srt" "%%x.fixed.srt"
    My effort to test multiple files ends in the app crashing - probably caused by my lack of understanding bat files syntax.
    Quote Quote  
  2. Member
    Join Date
    Apr 2007
    Location
    Australia
    Search Comp PM
    I haven't followed this through so there may be errors, but the following may help.

    From Microsoft commandline help: (for/?)
    Picking upper case variable names like %I makes it more readable and
    avoids confusion with the modifiers, which are not case sensitive.
    n, N, x, X are modifiers and may lead to confusion.
    Try this.
    sync.bat
    Code:
    @echo off
    for %%I in (*.mkv) do call alass.bat "%%I" "%%~nI.srt" "%%~nI.fixed.srt"
     pause
    Or maybe create an output sub-folder. (allows you to keep the original srt file names)
    Code:
    @echo off
    if not exist New\ md New
    for %%I in (*.mkv) do call alass.bat "%%I" "%%~nI.srt" "New\%%~nI.srt"
    pause
    Cheers
    Quote Quote  
  3. Member
    Join Date
    Dec 2005
    Location
    Canada
    Search Comp PM
    @pcspeak
    Many thanks for your help to get the app working the way I wanted..
    Using your bat file,the folder of input files is processed quickly.
    All subs are processed to the new folder and can be tested using VLC player to verify sync.
    Again, thank you for pointing out how to add clarity to dos files.
    Quote Quote  
  4. Member
    Join Date
    Apr 2007
    Location
    Australia
    Search Comp PM
    For me the next step would be to replace the old srt stream with the one in the New\ folder, creating a second mkv in the New\ folder.
    After the batch file checks if a new srt file exists.

    Edited to make the subs forced so VLC won't get confused with having an embedded subs stream in the mkv AND a separate srt file, both in the \New folder..

    Code:
    @echo off
    if not exist New\ md New
    for %%I in (*.mkv) do call alass.bat "%%I" "%%~nI.srt" "New\%%~nI.srt"
    for %%I in (*.mkv) do if exist "New\%%~nI.srt" ffmpeg.exe -i "%%I" -sub_charenc UTF-8 -i "New\%%~nI.srt" -map 0:0 -map 0:1 -map 1:s -disposition:s:0 forced -c copy "New\%%~nI.mkv"
    pause
    Cheers.
    Last edited by pcspeak; 10th Nov 2024 at 18:38. Reason: Clarity
    Quote Quote  
  5. Member
    Join Date
    Dec 2005
    Location
    Canada
    Search Comp PM
    That's a good feature for my situation, inasmuch as the person who needs the subs also has a problem turning the subs on.
    If I might pick your skills again:assume that I have a mix of mp4 and mkv, is it possible to have the batch file accept either of the 2 types (both in the same source folder with the subtitles?
    Quote Quote  
  6. Member
    Join Date
    Apr 2007
    Location
    Australia
    Search Comp PM
    Yes, for my batch file. I don't know about the alass program or batch file.
    You can add mp4 file types to the for in ( ) do command.
    e.g.
    Code:
    for %%I in (*.mkv, *.mp4) do call alass.bat "%%I" "%%~nI.srt" "New\%%~nI.srt"
    for %%I in (*.mkv, *.mp4) do if exist "New\%%~nI.srt" ffmpeg.exe -i "%%I" -sub_charenc UTF-8 -i "New\%%~nI.srt" -map 0:0 -map 0:1 -map 1:s -disposition:s:0 forced -c copy "New\%%~nI.mkv"
    In all cases the output will be an mkv. If you wish to have mp4 input and mp4 output then the batch file will not work as is.
    MP4 files were not originally designed to contain a subtitles stream. It can be done, but the mp4 won't play on a lot of freestanding devices.
    Disk players, even those reading an mp4 through a usb port often won't play the mp4 video.
    Stay with mkv type files if you can. To me it's the best format, by far.

    Cheers.
    Quote Quote  
  7. Member
    Join Date
    Dec 2005
    Location
    Canada
    Search Comp PM
    Tested with a mix of mp4 and mkv ok.
    MP4-->MKV is my usual procedure so that worked out ok.
    Many thanks for your assistance and patience!
    Quote Quote  



Similar Threads

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