-
-
Notifications
You must be signed in to change notification settings - Fork 179
Open
Description
I am using UrlSource for video processing (extracting thumbnails) and I want to extract video thumbnail every X seconds (gapInSeconds param). After a few or maybe even half of the thumbnails have been extracted, extracting stalls and never ends => In browser network, request has status 206, but a time property is constantly pending. Switching to BufferSource fixes the problem. A file that I'm testing on is around 240Mb big and stalling happens when I want to extract thumbnail every [3 - 29] seconds (I sent you the file in a discord chat). Every other gap works fine.
Piece of code that produces the stalling:
const extractThumbnailEveryXSeconds = (gapInSeconds: number) => {
return new Promise<(WrappedCanvas | null)[]>(async (resolve, reject) => {
if (!canvasSink) {
reject('Mediabunny is not initialized');
}
const startTimestamp = await videoTrack.getFirstTimestamp();
const endTimestamp = await videoTrack.computeDuration();
const noOfTimestamps = Math.ceil((endTimestamp - startTimestamp) / gapInSeconds) + 1;
const timestamps = [...Array(noOfTimestamps).keys()].map((p) => startTimestamp + p * gapInSeconds);
let results = [];
for await (const result of canvasSink.canvasesAtTimestamps(timestamps)) {
console.log(result);
results.push(result);
}
resolve(results);
})
}
acharlop
Metadata
Metadata
Assignees
Labels
No labels