Jellyfin Forum
Split MKV with chapters - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Off Topic (https://forum.jellyfin.org/f-off-topic)
+--- Forum: General Discussion (https://forum.jellyfin.org/f-general-discussion)
+--- Thread: Split MKV with chapters (/t-split-mkv-with-chapters)



Split MKV with chapters - felix920506 - 2023-07-20

I have a couple of DVD Rips from DVD releases of TV shows. In these releases. Each episode is a chapter and the whole thing is one very long mkv.
However, Jellyfin's metadata system doesn't really play nicely with this kind of media layout. Is there any easy way to split them up into individual files?


RE: Split MKV with chapters - TheDreadPirate - 2023-07-20

Handbrake allows you to select what chapter(s) to output. While you are using Handbrake, recompress the video if you haven't done so already. I've achieved over 80% file size reduction with HEVC while maintaining the DVD original quality.


RE: Split MKV with chapters - Tempus - 2023-07-20

I literally just had to deal with this issue too. If you use ffmpeg you can do this:

Get timecodes for all the chapters
ffprobe -i input.mkv -show_chapters > chapters.txt

Note the start_time and end_time for each chapter/episode

Make and run a .bat file for ffmpeg to create individual videos based on the timecodes, using -ss for the start time and -to for the end time
For example:
ffmpeg -i input.mkv -c:v libx264 -c:a aac -map 0:v:0 -map 0:a:0 -map_chapters -1 -sn -ss 0 -to 1310.32 "S01E01.mp4" -c:v libx264 -c:a aac -map 0:v:0 -map 0:a:0 -map_chapters -1 -sn -ss 1310.32 -to 2628.2 "S01E02.mp4" -c:v libx264 -c:a aac -map 0:v:0 -map 0:a:0 -map_chapters -1 -sn -ss 2628.2 -to 3940.92 "S01E03.mp4"


RE: Split MKV with chapters - Perseverant - 2023-07-20

I haven't had a chance to add this to my media handling guide yet, but there is a way to handle a situation like this doesn't require re-encoding or command line.  You can use an application called avidemux.  You can drag and drop the file in, set your start point on the timeline, set your end point, and when you save it'll spit out a file pretty quickly.

There are a couple of downsides to avidemux
1) It will only split on I-frames, but this shouldn't be a problem for you.  Because you're chopping up episodes, you should have plenty of black space between episodes to comfortably set your start and end points on I-frames.
2) It'll chop your video and audio, but it won't split subtitles for you.

If you have any questions, give me a shout.