From 66f6d78b679c7d987a4fe4e871c15cc8e22430c2 Mon Sep 17 00:00:00 2001 From: "Michael J. Cohen" Date: Fri, 20 Sep 2019 10:50:41 -0600 Subject: [PATCH 1/2] Sometimes the channel mapping doesn't work automatically --- lib/classes/video.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/classes/video.js b/lib/classes/video.js index a024aa9..04bb8ff 100644 --- a/lib/classes/video.js +++ b/lib/classes/video.js @@ -797,6 +797,9 @@ class Video { _self.ffmpegCommand.audioChannels(2).audioFilters('aresample=matrix_encoding=dplii'); stream.channels = 2; } + else if (stream.channels == 6) { + _self.ffmpegCommand.audioChannels(6).audioFilters('channelmap=channel_layout=5.1'); + } let bitrate = _self.options.HEAudioBitrate * stream.channels; _self.ffmpegCommand.outputOptions('-b:a:' + i, bitrate + 'k'); @@ -918,7 +921,7 @@ class Video { if (err.message.startsWith('ffmpeg was killed with signal')) reject(new Error('FFMPEGKILLED')); else - reject(new Error('ffmpeg exited with an error.')); + reject(new Error('ffmpeg exited with an error.' + stdout + stderr)); }); _self.ffmpegCommand.output(_self.output.path, { end: true From 7a538ca354aee00c6c27994c71b4cfb135b06469 Mon Sep 17 00:00:00 2001 From: "Michael J. Cohen" Date: Fri, 20 Sep 2019 10:52:57 -0600 Subject: [PATCH 2/2] also map 8ch --- lib/classes/video.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/classes/video.js b/lib/classes/video.js index 04bb8ff..077a8d0 100644 --- a/lib/classes/video.js +++ b/lib/classes/video.js @@ -800,6 +800,9 @@ class Video { else if (stream.channels == 6) { _self.ffmpegCommand.audioChannels(6).audioFilters('channelmap=channel_layout=5.1'); } + else if (stream.channels == 8) { + _self.ffmpegCommand.audioChannels(6).audioFilters('channelmap=channel_layout=7.1'); + } let bitrate = _self.options.HEAudioBitrate * stream.channels; _self.ffmpegCommand.outputOptions('-b:a:' + i, bitrate + 'k');