Skip to content

Commit

Permalink
don't create detected segments twice
Browse files Browse the repository at this point in the history
in mode 2
fixes #2236
  • Loading branch information
mifi committed Nov 29, 2024
1 parent 6e62561 commit 0114faf
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/main/ffmpeg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,15 @@ async function detectIntervals({ filePath, customArgs, onProgress, from, to, mat
start: midpoints[i - 1] ?? 0,
end: time,
},
{
start: time,
end: midpoints[i + 1] ?? (to - from),
},
]);

const lastMidpoint = midpoints.at(-1);
if (lastMidpoint != null) {
segments.push({
start: lastMidpoint,
end: to - from,
});
}
}

return adjustSegmentsWithOffset({ segments, from });
Expand Down

0 comments on commit 0114faf

Please sign in to comment.