1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2024-12-28 22:51:59 +00:00

fix(server): handle N/A duration response from ffprobe (#13803)

This commit is contained in:
Jason Rasmussen 2024-10-29 10:21:30 -04:00 committed by GitHub
parent 00dd9419a5
commit e029190a5d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -110,16 +110,16 @@ export class MediaRepository implements IMediaRepository {
format: {
formatName: results.format.format_name,
formatLongName: results.format.format_long_name,
duration: results.format.duration || 0,
bitrate: results.format.bit_rate ?? 0,
duration: this.parseFloat(results.format.duration),
bitrate: this.parseInt(results.format.bit_rate),
},
videoStreams: results.streams
.filter((stream) => stream.codec_type === 'video')
.filter((stream) => !stream.disposition?.attached_pic)
.map((stream) => ({
index: stream.index,
height: stream.height || 0,
width: stream.width || 0,
height: this.parseInt(stream.height),
width: this.parseInt(stream.width),
codecName: stream.codec_name === 'h265' ? 'hevc' : stream.codec_name,
codecType: stream.codec_type,
frameCount: this.parseInt(options?.countFrames ? stream.nb_read_packets : stream.nb_frames),
@ -215,4 +215,8 @@ export class MediaRepository implements IMediaRepository {
private parseInt(value: string | number | undefined): number {
return Number.parseInt(value as string) || 0;
}
private parseFloat(value: string | number | undefined): number {
return Number.parseFloat(value as string) || 0;
}
}