aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/ffprobe-utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/ffprobe-utils.ts')
-rw-r--r--server/helpers/ffprobe-utils.ts13
1 files changed, 11 insertions, 2 deletions
diff --git a/server/helpers/ffprobe-utils.ts b/server/helpers/ffprobe-utils.ts
index ef2aa3f89..bc87e49b1 100644
--- a/server/helpers/ffprobe-utils.ts
+++ b/server/helpers/ffprobe-utils.ts
@@ -175,10 +175,19 @@ async function getMetadataFromFile (path: string, existingProbe?: ffmpeg.Ffprobe
175 return new VideoFileMetadata(metadata) 175 return new VideoFileMetadata(metadata)
176} 176}
177 177
178async function getVideoFileBitrate (path: string, existingProbe?: ffmpeg.FfprobeData) { 178async function getVideoFileBitrate (path: string, existingProbe?: ffmpeg.FfprobeData): Promise<number> {
179 const metadata = await getMetadataFromFile(path, existingProbe) 179 const metadata = await getMetadataFromFile(path, existingProbe)
180 180
181 return metadata.format.bit_rate as number 181 let bitrate = metadata.format.bit_rate as number
182 if (bitrate && !isNaN(bitrate)) return bitrate
183
184 const videoStream = await getVideoStreamFromFile(path, existingProbe)
185 if (!videoStream) return undefined
186
187 bitrate = videoStream?.bit_rate
188 if (bitrate && !isNaN(bitrate)) return bitrate
189
190 return undefined
182} 191}
183 192
184async function getDurationFromVideoFile (path: string, existingProbe?: ffmpeg.FfprobeData) { 193async function getDurationFromVideoFile (path: string, existingProbe?: ffmpeg.FfprobeData) {