[kwlug-disc] Splitting files with subtitles

Charles M chaslinux at gmail.com
Mon Apr 11 16:47:16 EDT 2022


Thanks Paul and Jeff. Things are a bit complicated since I normally
add ALL the language subtitles available (English, Spanish, Japanese,
etc.) to my files. On Askubuntu someone posted a script to extract
single language titles using mkvtoolnix.

https://askubuntu.com/questions/452268/extract-subtitle-from-mkv-files

I might just use it to grab the English and Spanish subtitles then
look at writing a BASH script with some regex to modify the files
based on the subtracted time of where I cut the start of the
second/third video. Thanks for the ideas guys!

Charles

On Mon, 11 Apr 2022 at 16:14, Jeff Smith <crankyoldbugger at gmail.com> wrote:
>
> 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
>
> _______________________________________________
> kwlug-disc mailing list
> kwlug-disc at kwlug.org
> https://kwlug.org/mailman/listinfo/kwlug-disc_kwlug.org



-- 
Charles
Blog: https://chaslinux.com/
(My Asteroids reboot) Fasteroids: http://chaslinux.itch.io/fasteroids
Twitter/Identica/Google+: @chaslinux




More information about the kwlug-disc mailing list