Skip to content

Commit 251102e

Browse files
committed
subtract 1 frame in timestampOffset
fixes #2591
1 parent 251102f commit 251102e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/renderer/src/MediaSourcePlayer.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { FaVideo } from 'react-icons/fa';
66
import isDev from './isDev';
77
import { ChromiumHTMLVideoElement } from './types';
88
import { FFprobeStream } from '../../../ffprobe';
9+
import { getFrameDuration } from './util';
910

1011
const { compatPlayer: { createMediaSourceStream } } = window.require('@electron/remote').require('./index.js');
1112

@@ -97,7 +98,7 @@ async function startPlayback({ path, slaveVideo, masterVideo, videoStreamIndex,
9798
// console.log(mediaSource.readyState); // open
9899

99100
const sourceBuffer = mediaSource.addSourceBuffer(mimeCodec);
100-
sourceBuffer.timestampOffset = seekTo;
101+
sourceBuffer.timestampOffset = seekTo - getFrameDuration(fps); // subtract 1 frame in order to attempt to avoid this issue: https://github.com/mifi/lossless-cut/issues/2591#issuecomment-3478018458
101102

102103
signal.addEventListener('abort', () => sourceBuffer.abort());
103104

0 commit comments

Comments
 (0)