[kwlug-disc] Splitting files with subtitles

Jeff Smith crankyoldbugger at gmail.com
Mon Apr 11 16:13:52 EDT 2022


As someone who depends on subtitles (since I'm terrible at lip reading) 
I have a couple of tools for fixing subtitles..

First, if you want to extract the .srt file from inside a .mkv, you can 
do it with mkvmerge, a neat little utility.

Download mkvtoolnix from:

https://mkvtoolnix.download/downloads.html

You can use mkvmerge (from mkvtoolnix) to inspect the file to see what 
the ID of the subtitles data will be:

mkvmerge -i input.mkv

This will list the tracks, for example like this:

File 'input.mkv': container: Matroska
Track ID 1: video (V_MPEG4/ISO/AVC)
Track ID 2: audio (A_AAC)
Track ID 3: subtitles (S_TEXT/UTF8)

Based on the ID of the track, call the following command, where is the 
one you identified above.

mkvextract tracks input.mkv :.srt

So, in our case, that would have been:

mkvextract tracks input.mkv 3:subs.srt


Once you have your subtitle, you can easily edit it using GNOME 
Subtitles, which is actually fairly robust.  It allows you to change the 
times, edit lines, etc., all while seeing the video in its own viewer.

Hopefully this will help...

Jeff




On 2022-04-10 23:35, Paul Nijjar via kwlug-disc wrote:
> If you know the exact chopping point, then it seems feasible to me
> that you could write a script to rewrite the time codes on the
> subtitles file. I guess this would be delicate since minor errors in
> timings can really stand out, but I think it could be done pretty
> easily in Python or similar.
>
> - Paul
>
>
> On Sun, Apr 10, 2022 at 11:14:05AM -0400, Charles M wrote:
>> Most DVD media, television shows in particular, split into files per
>> episode of the show:
>>
>> showname - s01e01.mkv, showname - s01e02.mkv, showname - s01e03.mkv, etc.
>>
>> Occasionally I come across DVD media where a show isn't split, there's
>> just one big file on the DVD that comprises of several episodes:
>>
>> showname - s01e01 s01e02 s01e03.mkv
>>
>> There are many programs for Linux that can split up these single video files:
>>
>> Vidcutter, Openshot, Flowblade, etc.
>>
>> Unfortunately none of the solutions will also split beyond the first
>> episode with subtitles (I believe subtitles are usually embedded near
>> the beginning of a file, which would explain why they don't show when
>> the file is cropped in the middle).
>>
>> I've been thinking you could export the subtitle, chop the file, but
>> then you also need to go back and redo the time codes on the
>> subtitles.
>>
>> I think I know the answer to this but does anyone know of a program
>> that can chop files (after the beginning) and keep the subtitles? This
>> seems like something that would be an amazing feature for Vidcutter
>> (which is really nice for chopping files by the way).
>>
>> To be clear, if you crop s01e01, it will keep subtitles, but if you
>> chop in the middle of that file to another part for s01e02 there won't
>> be any subtitles (since it appears they're stored at the beginning).
>>
>> Thanks all,
>>
>> Charles
>>
>> _______________________________________________
>> kwlug-disc mailing list
>> kwlug-disc at kwlug.org
>> https://kwlug.org/mailman/listinfo/kwlug-disc_kwlug.org




More information about the kwlug-disc mailing list