X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fvideo%2Fvideo.ts;h=12b9375743702ce9c4778584ad7d66e0dbbcd957;hb=cbe2f36d93c779ca08424336be7e3988e57be01d;hp=e5077487a9c31710e382c20605f1867af0191ff3;hpb=78a5dd9c69af1b1fcae48a25053b569aa0eae626;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/video/video.ts b/server/models/video/video.ts index e5077487a..12b937574 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -33,7 +33,7 @@ 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 } from '@shared/core-utils' -import { uuidToShort } from '@shared/extra-utils' +import { ffprobePromise, getAudioStream, uuidToShort } from '@shared/extra-utils' import { ResultList, ThumbnailType, @@ -1678,12 +1678,20 @@ export class VideoModel extends Model>> { 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) + } }) }