#!/usr/bin/perl
 # Author: Alan J. Pippin
 # Description: Extract the given chapter(s) from an mkv file into separate video files
+# Requires: Newer version of ffmpeg to be installed that supports MKV chapters
 
 # MOV:
 # major_brand : qt
     if($line =~ /Chapter #\d+\.(\d+): start (\S+), end (\S+)/) {
        $chapter = $1;
        $start = $2;
+        if($start > 0) { $start += 1; } # Add some margin to prevent taking a piece of the previous clip
        $end = $3;
        $duration = $end - $start;
        if($duration < 0) { die "-E- Unexpected negative duration detected for chapter $chapter\n"; }