@@ -13,6 +13,7 @@ def aac_128k(
1313 metadata : nil ,
1414 threads : FFMPEG . threads ,
1515 audio_sample_rate : 48_000 ,
16+ audio_channels : 2 ,
1617 &
1718 )
1819 AAC . new (
@@ -21,6 +22,7 @@ def aac_128k(
2122 metadata :,
2223 threads :,
2324 audio_sample_rate :,
25+ audio_channels :,
2426 audio_bit_rate : '128k' ,
2527 &
2628 )
@@ -32,6 +34,7 @@ def aac_192k(
3234 metadata : nil ,
3335 threads : FFMPEG . threads ,
3436 audio_sample_rate : 48_000 ,
37+ audio_channels : 2 ,
3538 &
3639 )
3740 AAC . new (
@@ -40,6 +43,7 @@ def aac_192k(
4043 metadata :,
4144 threads :,
4245 audio_sample_rate :,
46+ audio_channels :,
4347 audio_bit_rate : '192k' ,
4448 &
4549 )
@@ -51,6 +55,7 @@ def aac_320k(
5155 metadata : nil ,
5256 threads : FFMPEG . threads ,
5357 audio_sample_rate : 48_000 ,
58+ audio_channels : 2 ,
5459 &
5560 )
5661 AAC . new (
@@ -59,6 +64,7 @@ def aac_320k(
5964 metadata :,
6065 threads :,
6166 audio_sample_rate :,
67+ audio_channels :,
6268 audio_bit_rate : '320k' ,
6369 &
6470 )
@@ -67,12 +73,14 @@ def aac_320k(
6773
6874 # Preset to encode AAC audio files.
6975 class AAC < Preset
70- attr_reader :threads , :audio_bit_rate , :audio_sample_rate
76+ attr_reader :threads , :audio_bit_rate , :audio_sample_rate , :audio_channels
7177
7278 # @param name [String] The name of the preset.
7379 # @param filename [String] The filename format of the output.
7480 # @param metadata [Object] The metadata to associate with the preset.
7581 # @param audio_bit_rate [String] The audio bit rate to use.
82+ # @param audio_sample_rate [Integer] The audio sample rate to use.
83+ # @param audio_channels [Integer, nil] The number of audio channels to use (nil to preserve source).
7684 # @yield The block to execute to compose the command arguments.
7785 def initialize (
7886 name : nil ,
@@ -81,11 +89,13 @@ def initialize(
8189 threads : FFMPEG . threads ,
8290 audio_bit_rate : '128k' ,
8391 audio_sample_rate : 48_000 ,
92+ audio_channels : 2 ,
8493 &
8594 )
8695 @threads = threads
8796 @audio_bit_rate = audio_bit_rate
8897 @audio_sample_rate = audio_sample_rate
98+ @audio_channels = audio_channels
8999 preset = self
90100
91101 super ( name :, filename :, metadata :) do
@@ -101,6 +111,7 @@ def initialize(
101111 map media . audio_mapping_id do
102112 audio_bit_rate preset . audio_bit_rate
103113 audio_sample_rate preset . audio_sample_rate
114+ audio_channels preset . audio_channels if preset . audio_channels
104115 end
105116 end
106117 end
0 commit comments