From 73bb73a04aa04fb123a9ff1ef8e96e3ce5c2201e Mon Sep 17 00:00:00 2001 From: Alistair Bahr Date: Mon, 2 Oct 2023 09:25:34 +0200 Subject: [PATCH 1/3] make force transcode apply to all "ffmpeg error 1" --- server/objects/Stream.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/objects/Stream.js b/server/objects/Stream.js index c8452ac3..1860c47f 100644 --- a/server/objects/Stream.js +++ b/server/objects/Stream.js @@ -340,7 +340,7 @@ class Stream extends EventEmitter { Logger.error('Ffmpeg Err', '"' + err.message + '"') // Temporary workaround for https://github.com/advplyr/audiobookshelf/issues/172 - const aacErrorMsg = 'ffmpeg exited with code 1: Could not write header for output file #0 (incorrect codec parameters ?)' + const aacErrorMsg = 'ffmpeg exited with code 1:' if (audioCodec === 'copy' && this.isAACEncodable && err.message && err.message.startsWith(aacErrorMsg)) { Logger.info(`[Stream] Re-attempting stream with AAC encode`) this.transcodeOptions.forceAAC = true From 4352989242bf9a25b092deafb7c50b5e17a0eadc Mon Sep 17 00:00:00 2001 From: Alistair1231 Date: Mon, 2 Oct 2023 09:30:57 +0200 Subject: [PATCH 2/3] update comment to include second issue that is adressed by change --- server/objects/Stream.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/objects/Stream.js b/server/objects/Stream.js index 1860c47f..9f5ff59b 100644 --- a/server/objects/Stream.js +++ b/server/objects/Stream.js @@ -339,7 +339,7 @@ class Stream extends EventEmitter { } else { Logger.error('Ffmpeg Err', '"' + err.message + '"') - // Temporary workaround for https://github.com/advplyr/audiobookshelf/issues/172 + // Temporary workaround for https://github.com/advplyr/audiobookshelf/issues/172 and https://github.com/advplyr/audiobookshelf/issues/2157 const aacErrorMsg = 'ffmpeg exited with code 1:' if (audioCodec === 'copy' && this.isAACEncodable && err.message && err.message.startsWith(aacErrorMsg)) { Logger.info(`[Stream] Re-attempting stream with AAC encode`) @@ -435,4 +435,4 @@ class Stream extends EventEmitter { return newAudioTrack } } -module.exports = Stream \ No newline at end of file +module.exports = Stream From 7c9631c1b0dbff6e15a33c72945ef69449225e0d Mon Sep 17 00:00:00 2001 From: advplyr Date: Mon, 2 Oct 2023 08:34:56 -0500 Subject: [PATCH 3/3] Update server/objects/Stream.js --- server/objects/Stream.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/objects/Stream.js b/server/objects/Stream.js index 9f5ff59b..115bb96e 100644 --- a/server/objects/Stream.js +++ b/server/objects/Stream.js @@ -341,7 +341,7 @@ class Stream extends EventEmitter { // Temporary workaround for https://github.com/advplyr/audiobookshelf/issues/172 and https://github.com/advplyr/audiobookshelf/issues/2157 const aacErrorMsg = 'ffmpeg exited with code 1:' - if (audioCodec === 'copy' && this.isAACEncodable && err.message && err.message.startsWith(aacErrorMsg)) { + if (audioCodec === 'copy' && this.isAACEncodable && err.message?.startsWith(aacErrorMsg)) { Logger.info(`[Stream] Re-attempting stream with AAC encode`) this.transcodeOptions.forceAAC = true this.reset(this.startTime)