2

I have a TV set that allows me to plug in a USB hard drive and will play movies in it. It supports a surprisingly wide range of codecs, but as I learned yesterday (the ugly way), while it'll play files over 2Gb, it can't read past the 2Gb mark, so it'll jump to the next movie without playing the ending...

I now have a whole bunch of 1080p movies over 2 hours long that I want to watch, and it doesn't look like there's a firmware update for my TV that'll fix this, so...

Does anyone know of some free program that'll split a movie file in two?

I'm looking for something that will "remake the header" and actually split the file in two, not something that'll treat it as a stream of frames and re-encode it (ie, something that'll take seconds to run, not hours, and will keep image quality intact).

If said program could also do the same for the subtitle file, that'd be ideal, although if it doesn't, I can probably code something that'll do that for me, if I know the exact point at which the movie was cut.

The movies in question are all either "mkv" or "mp4", and the subtitle files are all .srt

Oliver Salzburg
  • 89,072
  • 65
  • 269
  • 311

3 Answers3

4

In LINUX (Ubuntu) mkvmerge GUI is an excellent tool, but...

Depending on WHERE you are going to play the split files (blurays, tvs, especially), you MIGHT have problems with header compression. remove compression in GUI (older versions) or at command line:

mkvmerge --split 1G --compression 0:none --compression 1:none --clusters-in-meta-seek -o "output.mkv" "input.mkv"

This command will split the input.mkv file into 1GB segments input-001.mkv, input-002.mkv, etc.

In general, if the file plays on your computer but does NOT play on tv or disc player (bluray, dvd), your problem will usually be header compression.

warvariuc
  • 1,087
tony gil
  • 223
2

SplitMKV will do this: SplitMKV Development thread at Doom9.org

It is a command-line tool however, but fairly simple to use - and importantly has the subtitle support you require. It is based on MKVMerge, which performsthe video splitting, and SplitMKV itself takes care of the subtitles; correcting the offsets for the split output.

1

Another cool solution is to use bash to split multiple mkv files into multiple splitted mkv

You start from

nightmare1.mkv
nightmare2.mkv
..

and you get

nightmare1-001.mkv
nightmare1-002.mkv
..

nightmare2-001.mkv nightmare2-002.mkv ..

Code

for file in ./source/*mkv; \
do \
    echo mkvmerge --split 1G --compression 0:none --compression 1:none \
    --clusters-in-meta-seek -o "./split/$(basename "$file")" "$file"; \
done

In the above example ./source/ is a relative path to the directory where the original files are stored. Respectively ./split/ is the destination path and it must be preliminary crated.

For each iteration the value of the variable $file will look like ./source/nightmare-i.mkv. The command substitution $(basename "$file") will return only the filename without the path - i.e. nightmare-i.mkv, so the value of the output option will look like ./split/nightmare-i.mkv