Fix:Retry transcode forcing AAC to handle the bad audible m4bs #2720

This commit is contained in:
advplyr 2024-04-15 15:14:30 -05:00
parent 60c65008dc
commit 0f7c99d989

View File

@ -195,7 +195,7 @@ class Stream extends EventEmitter {
var current_chunk = [] var current_chunk = []
var last_seg_in_chunk = -1 var last_seg_in_chunk = -1
var segments = Array.from(this.segmentsCreated).sort((a, b) => a - b); var segments = Array.from(this.segmentsCreated).sort((a, b) => a - b)
var lastSegment = segments[segments.length - 1] var lastSegment = segments[segments.length - 1]
if (lastSegment > this.furthestSegmentCreated) { if (lastSegment > this.furthestSegmentCreated) {
this.furthestSegmentCreated = lastSegment this.furthestSegmentCreated = lastSegment
@ -342,7 +342,7 @@ class Stream extends EventEmitter {
Logger.error('Ffmpeg Err', '"' + err.message + '"') Logger.error('Ffmpeg Err', '"' + err.message + '"')
// Temporary workaround for https://github.com/advplyr/audiobookshelf/issues/172 and https://github.com/advplyr/audiobookshelf/issues/2157 // 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:' const aacErrorMsg = 'ffmpeg exited with code 1'
if (audioCodec === 'copy' && this.isAACEncodable && err.message?.startsWith(aacErrorMsg)) { if (audioCodec === 'copy' && this.isAACEncodable && err.message?.startsWith(aacErrorMsg)) {
Logger.info(`[Stream] Re-attempting stream with AAC encode`) Logger.info(`[Stream] Re-attempting stream with AAC encode`)
this.transcodeOptions.forceAAC = true this.transcodeOptions.forceAAC = true