VideoHelp Forum
+ Reply to Thread
Results 1 to 6 of 6
Thread
  1. Hello,

    2 years ago, I found on this forum I think a code to create a batch script (.bat) on a text editor like notepad to extract the subtitles from an MKV file.

    It didn't matter which folder the video was in, I just copy and pasted the batch file into the same folder as the video (nothing else), clicked on the batch file and it gave me the srt file no matter the file name of the video is.

    The problem is that I changed my PC and I can't find the batch file anymore. I tried to do some search on the forum but now I only find posts leading to software or something like that.

    If anyone has any idea about this, please let me know.

    Regards
    Last edited by pouki; 10th Sep 2022 at 10:08.
    Quote Quote  
  2. There are several programs that extract the subtitle channel from the video container. The most famous would be ffmpeg. The script that you lost most definitely had to call an external program to do the heavy lifting.

    Suggest that you post a link to your video container and I am positive that some kind soul will guide you through the process.

    In the meanwhile, use your friend Google to determine how to use ffmpeg to determine whether the video container has a subtitle component. Then use your friend again as to how to capture the subtitle from the container.

    Once these two steps are known (basically using ffmpeg flags), then it will be quite the no brainer to create a script to implement the process.

    I am positive that you are up to the challenge.
    Quote Quote  
  3. Hi jack.666 and thanks for your answer. The video container is an 1080p mkv.

    I know a bit about how ffmpeg works, I use it to assemble video and sound after "decrypting".

    I also know how to extract subtitles from the video if I paste the video in the users/my nickname folder (where all the tools are: mp4decrypt, ffmpeg, youtube-dlc etc).

    For example with this line: "ffmpeg -i video.mkv -map 0:0 video.srt" I have the subtitle without any problem.

    But with the script, no matter which folder the video was in, when I pasted the script into a folder and opened it, it made the subtitles of the video(s) in the folder available.
    Quote Quote  
  4. Put a copy of ffmpeg.exe in C:\windows\system32. Then your batch file should look like:

    Code:
    for %%F in (*.mkv) do (ffmpeg -i "%%~dpnxF" -map 0:s:0 "%%~dpnF.SRT" )
    That will extract the first SRT from each MKV file in the folder.

    folder contents before running batch file:
    Image
    [Attachment 66683 - Click to enlarge]


    folder content after running batch file:
    Image
    [Attachment 66684 - Click to enlarge]
    Quote Quote  
  5. Thanks you jagabo, this is exactly what i want and it works like a charm.
    Quote Quote  
  6. Member Ygramul's Avatar
    Join Date
    Jan 2007
    Location
    Poland
    Search Comp PM
    You can also use gMKVExtractGUI. It has a simple interface that lets you pick anything inside an MKV container.
    Quote Quote  



Similar Threads

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