kopia lustrzana https://github.com/mifi/lossless-cut
improve random segment generation
make sure random segment start time is also randomized also clamp end timepull/1437/head
rodzic
4f018b0f12
commit
16c9f8b002
|
@ -359,8 +359,8 @@ export async function createRandomSegments(fileDuration) {
|
|||
const randomInRange = (min, max) => min + Math.random() * (max - min);
|
||||
|
||||
const edl = [];
|
||||
for (let start = 0; start < fileDuration && edl.length < maxSegments; start += randomInRange(gapMin, gapMax)) {
|
||||
const end = start + randomInRange(durationMin, durationMax);
|
||||
for (let start = randomInRange(gapMin, gapMax); start < fileDuration && edl.length < maxSegments; start += randomInRange(gapMin, gapMax)) {
|
||||
const end = Math.min(fileDuration, start + randomInRange(durationMin, durationMax));
|
||||
edl.push({ start, end });
|
||||
start = end;
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue