mirror of
https://github.com/immich-app/immich.git
synced 2026-04-30 21:10:40 -04:00
use totalDuration instead of format.duration
This commit is contained in:
parent
c38215e0aa
commit
c5fb4ac970
@ -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<VideoPacketInfo | null> {
|
||||
if (formatDuration <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
async probePackets(input: string, streamIndex: number): Promise<VideoPacketInfo | null> {
|
||||
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,
|
||||
|
||||
@ -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<ImmichTags, 'Duration' | 'Orientation' | 'ImageWidth' | 'ImageHeight'> = {};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user