Kaynağa Gözat

Add support for SSA subtitles

Zachary Kotlarek 13 yıl önce
ebeveyn
işleme
f0a1b61205
3 değiştirilmiş dosya ile 15 ekleme ve 2 silme
  1. 3 0
      encode.pl
  2. 3 0
      recode
  3. 9 2
      toMKV.sh

+ 3 - 0
encode.pl

@@ -64,6 +64,9 @@ my %titles = &scan($in_file);
 if (scalar(keys(%titles)) == 1) {
 	my $srt_file = $in_file;
 	$srt_file =~ s/\.\w{2,4}$/.srt/;
+	if (! -r $srt_file) {
+		$srt_file =~ s/\.\w{2,4}$/.ssa/;		
+	}
 	if (-r $srt_file) {
 		if ($DEBUG) {
 			print STDERR 'Adding subtitles from: ' . $srt_file . "\n";

+ 3 - 0
recode

@@ -89,6 +89,9 @@ fi
 if [ $KEEP_IN -eq 0 ]; then
 	rm -f "${IN}"
 	SRT="`echo "${IN}" | sed 's%\.[^\.]*$%%'`.srt"
+	if [ ! -e "${SRT}" ]; then
+		SRT="`echo "${IN}" | sed 's%\.[^\.]*$%%'`.ssa"
+	fi
 	if [ -e "${SRT}" ]; then
 		rm -f "${SRT}"
 	fi

+ 9 - 2
toMKV.sh

@@ -31,6 +31,9 @@ fi
 
 # Merge external subtitles, if they exist
 srtFile="`echo "${inFile}" | sed 's%\.[^\.]*$%%'`.srt"
+if [ ! -e "${srtFile}" ]; then
+	srtFile="`echo "${inFile}" | sed 's%\.[^\.]*$%%'`.ssa"
+fi
 if [ ! -e "${srtFile}" ]; then
 	srtFile=""
 fi
@@ -39,8 +42,12 @@ fi
 # Hide some common AVI conversion warnings
 tmpFile="`mktemp -t toMKV`"
 outFile="${outFile}.mkv"
-mkvmerge --quiet -o "${tmpFile}" "${inFile}" ${srtFile} 2>&1 | \
-	grep -v "The AVC video track is missing the 'CTTS' atom for frame timecode offsets."
+if [ -n "${srtFile}" ]; then
+	OUT="`mkvmerge --quiet -o "${tmpFile}" "${inFile}" "${srtFile}" 2>&1`"
+else
+	OUT="`mkvmerge --quiet -o "${tmpFile}" "${inFile}" 2>&1`"
+fi
+echo "${OUT}" | grep -v "The AVC video track is missing the 'CTTS' atom for frame timecode offsets."
 
 # Check for errors
 if [ ! -e "${tmpFile}" ] || [ `stat -f '%z' "${tmpFile}"` -lt 1000 ]; then