import { VideoPathManager } from '@server/lib/video-path-manager'
import { getServerActor } from '@server/models/application/application'
import { ModelCache } from '@server/models/model-cache'
-import { buildVideoEmbedPath, buildVideoWatchPath, pick, uuidToShort } from '@shared/core-utils'
+import { buildVideoEmbedPath, buildVideoWatchPath, pick } from '@shared/core-utils'
+import { ffprobePromise, getAudioStream, uuidToShort } from '@shared/extra-utils'
import {
ResultList,
ThumbnailType,
required: false,
where: {
startDate: {
- [Op.gte]: new Date(new Date().getTime() - (24 * 3600 * 1000) * trendingDays)
+ // FIXME: ts error
+ [Op.gte as any]: new Date(new Date().getTime() - (24 * 3600 * 1000) * trendingDays)
}
}
}
return peertubeTruncate(this.description, { length: maxLength })
}
- getMaxQualityResolution () {
+ getMaxQualityFileInfo () {
const file = this.getMaxQualityFile()
const videoOrPlaylist = file.getVideoOrStreamingPlaylist()
- return VideoPathManager.Instance.makeAvailableVideoFile(file.withVideoOrPlaylist(videoOrPlaylist), originalFilePath => {
- return getVideoFileResolution(originalFilePath)
+ return VideoPathManager.Instance.makeAvailableVideoFile(file.withVideoOrPlaylist(videoOrPlaylist), async originalFilePath => {
+ const probe = await ffprobePromise(originalFilePath)
+
+ const { audioStream } = await getAudioStream(originalFilePath, probe)
+
+ return {
+ audioStream,
+
+ ...await getVideoFileResolution(originalFilePath, probe)
+ }
})
}