mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-02-19 00:18:56 +01:00
Fix:FLAC files use mpegts segment type and force AAC transcode
This commit is contained in:
parent
c0c4b1fa23
commit
6683301106
@ -63,9 +63,12 @@ class Stream extends EventEmitter {
|
|||||||
return this.tracks[0].ext.toLowerCase().slice(1)
|
return this.tracks[0].ext.toLowerCase().slice(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fmp4 does not work on iOS devices: https://github.com/advplyr/audiobookshelf-app/issues/85
|
||||||
|
// Workaround: Force AAC transcode for FLAC
|
||||||
get hlsSegmentType() {
|
get hlsSegmentType() {
|
||||||
var hasFlac = this.tracks.find(t => t.ext.toLowerCase() === '.flac')
|
return 'mpegts'
|
||||||
return hasFlac ? 'fmp4' : 'mpegts'
|
// var hasFlac = this.tracks.find(t => t.ext.toLowerCase() === '.flac')
|
||||||
|
// return hasFlac ? 'fmp4' : 'mpegts'
|
||||||
}
|
}
|
||||||
|
|
||||||
get segmentBasename() {
|
get segmentBasename() {
|
||||||
@ -333,7 +336,9 @@ class Stream extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const logLevel = process.env.NODE_ENV === 'production' ? 'error' : 'warning'
|
const logLevel = process.env.NODE_ENV === 'production' ? 'error' : 'warning'
|
||||||
const audioCodec = (this.hlsSegmentType === 'fmp4' || this.tracksAudioFileType === 'opus' || this.transcodeForceAAC) ? 'aac' : 'copy'
|
|
||||||
|
const audioCodec = (this.tracksAudioFileType === 'flac' || this.tracksAudioFileType === 'opus' || this.transcodeForceAAC) ? 'aac' : 'copy'
|
||||||
|
|
||||||
this.ffmpeg.addOption([
|
this.ffmpeg.addOption([
|
||||||
`-loglevel ${logLevel}`,
|
`-loglevel ${logLevel}`,
|
||||||
'-map 0:a',
|
'-map 0:a',
|
||||||
@ -354,8 +359,8 @@ class Stream extends EventEmitter {
|
|||||||
]
|
]
|
||||||
if (this.hlsSegmentType === 'fmp4') {
|
if (this.hlsSegmentType === 'fmp4') {
|
||||||
hlsOptions.push('-strict -2')
|
hlsOptions.push('-strict -2')
|
||||||
// var fmp4InitFilename = Path.join(this.streamPath, 'init.mp4')
|
var fmp4InitFilename = Path.join(this.streamPath, 'init.mp4')
|
||||||
var fmp4InitFilename = 'init.mp4'
|
// var fmp4InitFilename = 'init.mp4'
|
||||||
hlsOptions.push(`-hls_fmp4_init_filename ${fmp4InitFilename}`)
|
hlsOptions.push(`-hls_fmp4_init_filename ${fmp4InitFilename}`)
|
||||||
}
|
}
|
||||||
this.ffmpeg.addOption(hlsOptions)
|
this.ffmpeg.addOption(hlsOptions)
|
||||||
|
Loading…
Reference in New Issue
Block a user