This commit is contained in:
David Leimroth 2022-02-07 14:50:19 +01:00
commit 27f498ffae
5 changed files with 18 additions and 14 deletions

View File

@ -1,6 +1,6 @@
{
"name": "audiobookshelf-client",
"version": "1.6.64",
"version": "1.6.65",
"description": "Audiobook manager and player",
"main": "index.js",
"scripts": {

View File

@ -1,6 +1,6 @@
{
"name": "audiobookshelf",
"version": "1.6.64",
"version": "1.6.65",
"description": "Self-hosted audiobook server for managing and playing audiobooks",
"main": "index.js",
"scripts": {

View File

@ -532,7 +532,7 @@ class Server {
var exists = await fs.pathExists(outputDirectory)
if (exists) {
Logger.error(`[Server] Upload directory "${outputDirectory}" already exists`)
return res.status(500).error(`Directory "${outputDirectory}" already exists`)
return res.status(500).send(`Directory "${outputDirectory}" already exists`)
}
await fs.ensureDir(outputDirectory)

View File

@ -63,9 +63,12 @@ class Stream extends EventEmitter {
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() {
var hasFlac = this.tracks.find(t => t.ext.toLowerCase() === '.flac')
return hasFlac ? 'fmp4' : 'mpegts'
return 'mpegts'
// var hasFlac = this.tracks.find(t => t.ext.toLowerCase() === '.flac')
// return hasFlac ? 'fmp4' : 'mpegts'
}
get segmentBasename() {
@ -333,7 +336,9 @@ class Stream extends EventEmitter {
}
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([
`-loglevel ${logLevel}`,
'-map 0:a',
@ -354,8 +359,8 @@ class Stream extends EventEmitter {
]
if (this.hlsSegmentType === 'fmp4') {
hlsOptions.push('-strict -2')
// var fmp4InitFilename = Path.join(this.streamPath, 'init.mp4')
var fmp4InitFilename = 'init.mp4'
var fmp4InitFilename = Path.join(this.streamPath, 'init.mp4')
// var fmp4InitFilename = 'init.mp4'
hlsOptions.push(`-hls_fmp4_init_filename ${fmp4InitFilename}`)
}
this.ffmpeg.addOption(hlsOptions)

View File

@ -1,5 +1,8 @@
const ffprobe = require('node-ffprobe')
const Path = require('path')
if (process.env.FFPROBE_PATH) {
ffprobe.FFPROBE_PATH = process.env.FFPROBE_PATH
}
const AudioProbeData = require('../scanner/AudioProbeData')
@ -278,11 +281,7 @@ function parseProbeData(data, verbose = false) {
// Updated probe returns AudioProbeData object
function probe(filepath, verbose = false) {
var options = {}
if (process.env.FFPROBE_PATH) {
options.path = process.env.FFPROBE_PATH
}
return ffprobe(filepath, options)
return ffprobe(filepath)
.then(raw => {
var rawProbeData = parseProbeData(raw, verbose)
if (!rawProbeData || !rawProbeData.audio_stream) {