Procházet zdrojové kódy

Skip DTS-Express tracks; FFMPEG has (limited) support but HandBrake does not. Install a general system for excluding incompatible audio tracks.

Zachary Kotlarek před 14 roky
rodič
revize
f09542ee55
1 změnil soubory, kde provedl 13 přidání a 3 odebrání
  1. 13 3
      encode.pl

+ 13 - 3
encode.pl

@@ -281,10 +281,15 @@ sub audioOptions($) {
 				$codec = $code;
 				last;
 			} elsif ($code eq 'OTHER') {
-				if (!($codec =~ /MP3/i || $codec =~ /MPEG/i)) {
+				if ($codec =~ /MP3/i || $codec =~ /MPEG/i) {
+					$codec = $code;
+				} elsif ($codec eq 'dca') {
+					print STDERR 'Found incompatible audio (' . $track->{'description'} . ')  in track ' . $track->{'index'} . "\n";
+					$codec = undef();
+				} else {
 					print STDERR 'Found unknown audio (' . $track->{'description'} . ') in track ' . $track->{'index'} . "\n";
+					$codec = $code;
 				}
-				$codec = $code;
 			}
 		}
 
@@ -347,6 +352,11 @@ sub audioOptions($) {
 				print STDERR 'Skipping recode of track ' . $index . ' since it is already used as the default track and contains only ' . $tracks{$index}->{'channels'} . " channels\n";
 			}
 			next;
+		} elsif (!$tracks{$index}->{'codec'}) {
+			if ($DEBUG) {
+				print STDERR 'Skipping track ' . $index . " due to invalid codec\n";
+			}
+			next;
 		} elsif (!isValidAudioLanguage($tracks{$index}->{'language'}, $tracks{$index}->{'iso'})) {
 			if ($DEBUG) {
 				print STDERR 'Skipping track ' . $index . ' due to language: ' . $tracks{$index}->{'language'} . "\n";
@@ -488,7 +498,7 @@ sub findBestAudioTrack($$) {
 		my $track = $tracks->{$index};
 
 		# Skip tracks not in the specified codec
-		if ($track->{'codec'} ne $codec) {
+		if (!$track->{'codec'} || $track->{'codec'} ne $codec) {
 			next;
 		}