Selaa lähdekoodia

Be more willing to throw out stereo channels in favor of the default mixdown

Zachary Kotlarek 13 vuotta sitten
vanhempi
sitoutus
43adef1627
1 muutettua tiedostoa jossa 6 lisäystä ja 4 poistoa
  1. 6 4
      encode.pl

+ 6 - 4
encode.pl

@@ -19,13 +19,15 @@ my $AUDIO_EXCLUDE_REGEX = '\b(?:Chinese|Espanol|Francais|Japanese|Korean|Portugu
 my $SUB_INCLUDE_REGEX   = '\b(?:English|Unknown|Closed\s+Captions)\b';
 my $FORCE_MP4           = 0;
 my $OUT_DIR             = undef();
+my $MIXDOWN_CODEC       = 'AAC';
+my $MIXDOWN_CHANNELS    = 2.0;
 
 # Applicaton configuration
 my $HD_WIDTH         = 1350;
 my $MIN_VIDEO_WIDTH  = 100;
 my $MAX_CROP_DIFF    = .1;
 my $MAX_DURA_DIFF    = 5;
-my @CODEC_ORDER      = ('DTS-HD', 'DTS', 'PCM', 'AC3', 'AAC', 'OTHER');
+my @CODEC_ORDER      = ('DTS-HD', 'DTS', 'PCM', 'AC3', $MIXDOWN_CODEC, 'OTHER');
 my %LANG_INCLUDE_ISO = ('639-1' => 1);
 my $HB_EXEC          = $ENV{'HOME'} . '/bin/video/HandBrakeCLI';
 my $DEBUG            = 0;
@@ -504,7 +506,7 @@ sub audioOptions($) {
 		# Passthru DTS-MA, DTS, AC3, and AAC
 		# Keep other audio tracks, but recode to AAC (using Handbrake's audio-copy-mask/audio-fallback feature)
 		foreach my $index (keys(%tracks)) {
-			if (defined($mixdown) && $mixdown == $index && $tracks{$index}->{'codec'} eq 'OTHER' && $tracks{$index}->{'channels'} <= 2) {
+			if (defined($mixdown) && $mixdown == $index && $tracks{$index}->{'channels'} <= $MIXDOWN_CHANNELS) {
 				if ($DEBUG) {
 					print STDERR 'Skipping recode of track ' . $index . ' since it is already used as the default track and contains only ' . $tracks{$index}->{'channels'} . " channels\n";
 				}
@@ -537,8 +539,8 @@ sub audioOptions($) {
 		# The mixdown track needs special handling -- it appears twice, and with different settings
 		if ($track->{'encoder'} ne 'copy' && defined($mixdown) && $mixdown > 0 && $track->{'index'} == $mixdown) {
 			$index .= '_mixdown';
-			$tmp{'codec'}    = 'AAC';
-			$tmp{'channels'} = '2.0';
+			$tmp{'codec'}    = $MIXDOWN_CODEC;
+			$tmp{'channels'} = $MIXDOWN_CHANNELS;
 		}
 
 		# Collect our (possibly modified) hash