@ -24,6 +24,12 @@ module.exports = function transcodeAddAudioStream(
audioCodec = "mp3" ;
}
let extraArgs = "" ;
if ( audioEncoder === 'truehd' ) {
extraArgs = "-strict -2" ;
}
//Step 1: Check if the file already has the required stream codec/langtag/channel count
var hasStreamAlready = file . ffProbeData . streams . filter ( ( stream ) => {
@ -122,7 +128,7 @@ module.exports = function transcodeAddAudioStream(
} ;
} else {
return {
preset : ` ,-map 0:v -map 0: ${ highestChannelCount . index } -map 0:a -map 0:s? -map 0:d? -c copy -c:a:0 ${ audioEncoder } -ac ${ channelCount } -max_muxing_queue_size 9999 ` ,
preset : ` ,-map 0:v -map 0: ${ highestChannelCount . index } -map 0:a -map 0:s? -map 0:d? -c copy -c:a:0 ${ audioEncoder } -ac ${ channelCount } -max_muxing_queue_size 9999 ${ extraArgs } ` ,
processFile : true ,
note : ` The required channel count ${ channelCount } is lower than the highest available channel count ( ${ highestChannelCount . channels } ). Adding! \n ` ,
} ;
@ -155,7 +161,7 @@ module.exports = function transcodeAddAudioStream(
} ;
} else {
return {
preset : ` ,-map 0:v -map 0: ${ highestChannelCount . index } -map 0:a -map 0:s? -map 0:d? -c copy -c:a:0 ${ audioEncoder } -ac ${ highestChannelCount . channels } -max_muxing_queue_size 9999 ` ,
preset : ` ,-map 0:v -map 0: ${ highestChannelCount . index } -map 0:a -map 0:s? -map 0:d? -c copy -c:a:0 ${ audioEncoder } -ac ${ highestChannelCount . channels } -max_muxing_queue_size 9999 ${ extraArgs } ` ,
processFile : true ,
note : ` The required channel count ( ${ channelCount } ) is higher than the highest channel available in specified lang tag ( ${ highestChannelCount . channels } ). Adding lower channel track. \n ` ,
} ;
@ -229,7 +235,7 @@ module.exports = function transcodeAddAudioStream(
} ;
} else {
return {
preset : ` ,-map 0:v -map 0: ${ highestChannelCount . index } -map 0:a -map 0:s? -map 0:d? -c copy -c:a:0 ${ audioEncoder } -ac ${ channelCount } -max_muxing_queue_size 9999 ` ,
preset : ` ,-map 0:v -map 0: ${ highestChannelCount . index } -map 0:a -map 0:s? -map 0:d? -c copy -c:a:0 ${ audioEncoder } -ac ${ channelCount } -max_muxing_queue_size 9999 ${ extraArgs } ` ,
processFile : true ,
note : ` The required channel count ${ channelCount } is lower than the highest available channel count ( ${ highestChannelCount . channels } ). Adding! \n ` ,
} ;
@ -260,7 +266,7 @@ module.exports = function transcodeAddAudioStream(
} ;
} else {
return {
preset : ` ,-map 0:v -map 0: ${ highestChannelCount . index } -map 0:a -map 0:s? -map 0:d? -c copy -c:a:0 ${ audioEncoder } -ac ${ highestChannelCount . channels } -max_muxing_queue_size 9999 ` ,
preset : ` ,-map 0:v -map 0: ${ highestChannelCount . index } -map 0:a -map 0:s? -map 0:d? -c copy -c:a:0 ${ audioEncoder } -ac ${ highestChannelCount . channels } -max_muxing_queue_size 9999 ${ extraArgs } ` ,
processFile : true ,
note : ` The required channel count ( ${ channelCount } ) is higher than the highest channel available in specified lang tag ( ${ highestChannelCount . channels } ). Adding lower channel track. \n ` ,
} ;