pull/901/head
Mikael Finstad 4 years ago
parent 713c808cd9
commit ad6aaae089
No known key found for this signature in database
GPG Key ID: 25AB36E3E81CBC26

@ -95,13 +95,13 @@ function getIntervalAroundTime(time, window) {
};
}
export async function readFrames({ filePath, aroundTime, window, stream }) {
export async function readFrames({ filePath, aroundTime, window, streamIndex }) {
let intervalsArgs = [];
if (aroundTime != null) {
const { from, to } = getIntervalAroundTime(aroundTime, window);
intervalsArgs = ['-read_intervals', `${from}%${to}`];
}
const { stdout } = await runFfprobe(['-v', 'error', ...intervalsArgs, '-show_packets', '-select_streams', stream, '-show_entries', 'packet=pts_time,flags', '-of', 'json', filePath]);
const { stdout } = await runFfprobe(['-v', 'error', ...intervalsArgs, '-show_packets', '-select_streams', streamIndex, '-show_entries', 'packet=pts_time,flags', '-of', 'json', filePath]);
const packetsFiltered = JSON.parse(stdout).packets
.map(p => ({
keyframe: p.flags[0] === 'K',

@ -26,7 +26,7 @@ export default ({ keyframesEnabled, filePath, commandedTime, mainVideoStream, de
if (!shouldRun) return;
try {
const promise = readFrames({ filePath, aroundTime: commandedTime, stream: mainVideoStream.index, window: ffmpegExtractWindow });
const promise = readFrames({ filePath, aroundTime: commandedTime, streamIndex: mainVideoStream.index, window: ffmpegExtractWindow });
readingKeyframesPromise.current = promise;
const newFrames = await promise;
if (aborted) return;

Loading…
Cancel
Save