Skip to content

Extracting thumbnails stalls when using UrlSource as InputΒ #243

@LovroS02

Description

@LovroS02

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);
    })
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions