mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-11-10 01:19:37 +01:00
Merge pull request #4808 from Vito0912/feat/eac3
Support eac3 and ac3 in transcodes
This commit is contained in:
commit
a4c9b062c1
@ -73,7 +73,7 @@ class Stream extends EventEmitter {
|
|||||||
return [AudioMimeType.FLAC, AudioMimeType.OPUS, AudioMimeType.WMA, AudioMimeType.AIFF, AudioMimeType.WEBM, AudioMimeType.WEBMA, AudioMimeType.AWB, AudioMimeType.CAF]
|
return [AudioMimeType.FLAC, AudioMimeType.OPUS, AudioMimeType.WMA, AudioMimeType.AIFF, AudioMimeType.WEBM, AudioMimeType.WEBMA, AudioMimeType.AWB, AudioMimeType.CAF]
|
||||||
}
|
}
|
||||||
get codecsToForceAAC() {
|
get codecsToForceAAC() {
|
||||||
return ['alac']
|
return ['alac', 'ac3', 'eac3']
|
||||||
}
|
}
|
||||||
get userToken() {
|
get userToken() {
|
||||||
return this.user.token
|
return this.user.token
|
||||||
@ -273,7 +273,16 @@ class Stream extends EventEmitter {
|
|||||||
audioCodec = 'aac'
|
audioCodec = 'aac'
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ffmpeg.addOption([`-loglevel ${logLevel}`, '-map 0:a', `-c:a ${audioCodec}`])
|
const codecOptions = [`-loglevel ${logLevel}`, '-map 0:a']
|
||||||
|
|
||||||
|
if (['ac3', 'eac3'].includes(this.tracksCodec) && this.tracks.length > 0 && this.tracks[0].bitRate && this.tracks[0].channels) {
|
||||||
|
// In case for ac3/eac3 it needs to be passed the bitrate and channels to avoid ffmpeg errors
|
||||||
|
codecOptions.push(`-c:a ${audioCodec}`, `-b:a ${this.tracks[0].bitRate}`, `-ac ${this.tracks[0].channels}`)
|
||||||
|
} else {
|
||||||
|
codecOptions.push(`-c:a ${audioCodec}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.ffmpeg.addOption(codecOptions)
|
||||||
const hlsOptions = ['-f hls', '-copyts', '-avoid_negative_ts make_non_negative', '-max_delay 5000000', '-max_muxing_queue_size 2048', `-hls_time 6`, `-hls_segment_type ${this.hlsSegmentType}`, `-start_number ${this.segmentStartNumber}`, '-hls_playlist_type vod', '-hls_list_size 0', '-hls_allow_cache 0']
|
const hlsOptions = ['-f hls', '-copyts', '-avoid_negative_ts make_non_negative', '-max_delay 5000000', '-max_muxing_queue_size 2048', `-hls_time 6`, `-hls_segment_type ${this.hlsSegmentType}`, `-start_number ${this.segmentStartNumber}`, '-hls_playlist_type vod', '-hls_list_size 0', '-hls_allow_cache 0']
|
||||||
this.ffmpeg.addOption(hlsOptions)
|
this.ffmpeg.addOption(hlsOptions)
|
||||||
if (this.hlsSegmentType === 'fmp4') {
|
if (this.hlsSegmentType === 'fmp4') {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user