From c5fb4ac970c8ff66b91d6952aa7c1d077386d91f Mon Sep 17 00:00:00 2001 From: mertalev <101130780+mertalev@users.noreply.github.com> Date: Thu, 23 Apr 2026 16:00:03 -0400 Subject: [PATCH] use totalDuration instead of format.duration --- server/src/repositories/media.repository.ts | 13 ++----------- server/src/services/metadata.service.ts | 5 +---- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/server/src/repositories/media.repository.ts b/server/src/repositories/media.repository.ts index f5ce18736e..75488f3eca 100644 --- a/server/src/repositories/media.repository.ts +++ b/server/src/repositories/media.repository.ts @@ -310,16 +310,7 @@ export class MediaRepository { * Needed for accurate segments, especially when remuxing, seeking and/or VFR is involved. * Scanning packets for keyframes in JS is much faster than -skip_frame nokey since it avoids decoding the video. */ - async probePackets( - input: string, - streamIndex: number, - timeBase: number, - formatDuration: number, - ): Promise { - if (formatDuration <= 0) { - return null; - } - + async probePackets(input: string, streamIndex: number): Promise { const { stdout } = await execFile('ffprobe', [ '-v', 'error', @@ -369,7 +360,7 @@ export class MediaRepository { return { totalDuration, packetCount: postDiscard.length, - outputFrames: this.cfrOutputFrames(postDiscard, postDiscard.length / formatDuration / timeBase), + outputFrames: this.cfrOutputFrames(postDiscard, postDiscard.length / totalDuration), keyframePts, keyframeAccDuration, keyframeOwnDuration, diff --git a/server/src/services/metadata.service.ts b/server/src/services/metadata.service.ts index c8737d4316..9517f07193 100644 --- a/server/src/services/metadata.service.ts +++ b/server/src/services/metadata.service.ts @@ -1080,10 +1080,7 @@ export class MetadataService extends BaseService { const { videoStreams, audioStreams, format } = await this.mediaRepository.probe(originalPath); const video = videoStreams[0]; const audio = audioStreams[0]; - const packets = - video && video.timeBase - ? await this.mediaRepository.probePackets(originalPath, video.index, video.timeBase, format.duration) - : null; + const packets = video?.timeBase ? await this.mediaRepository.probePackets(originalPath, video.index) : null; const tags: Pick = {};