X-Git-Url: http://git.pippins.net/embedvideo/.git/static/git-logo.png?a=blobdiff_plain;f=mkv_extract_chapter;h=1d969e8350145467d0c2b7ffdd363e4fcca23736;hb=bceefcbd297683c9e15c33f945fcb99006f6030a;hp=53d3cb741d016820b0ebef43cd21370d2b9a55a1;hpb=75451c9e69007a30fbbff4573a787a8b3fa09f62;p=videoscripts%2F.git diff --git a/mkv_extract_chapter b/mkv_extract_chapter index 53d3cb7..1d969e8 100755 --- a/mkv_extract_chapter +++ b/mkv_extract_chapter @@ -1,6 +1,7 @@ #!/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 @@ -83,7 +84,7 @@ sub detect_ext { } if($h264 && $pcm_s16le) { return "mov"; } - if($h264_high && $ac3) { return "mts"; } + if($h264_high && $ac3) { return "mp4"; } if($h264 && $aac) { return "mp4"; } return "UNKNOWN"; @@ -113,6 +114,7 @@ foreach $line (@ffmpeg_info) { 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"; } @@ -128,6 +130,7 @@ foreach $line (@ffmpeg_info) { print "$cmd\n"; } else { print "\n"; + print "$cmd\n"; $errno = system("$cmd"); $errno = $errno >> 8; if($errno > 0) { die "-E- ffmpeg encountered some errors with exit code $errno\n"; }