fix: 本地字幕合成视频只有 10 秒

This commit is contained in:
2025-02-10 14:48:40 +08:00
parent 253866d90f
commit b792d4d33a

View File

@@ -39,10 +39,9 @@ export const useVideoSubtitleEmbedding = async (
}; };
} }
const videoSprite = new OffscreenSprite( const videoClip = new MP4Clip((await fetch(videoUrl)).body!)
new MP4Clip((await fetch(videoUrl)).body!) const videoSprite = new OffscreenSprite(videoClip)
); videoSprite.time = { duration: videoClip.meta.duration, offset: 0 }
videoSprite.time = { duration: 10e6, offset: 0 };
await videoSprite.ready; await videoSprite.ready;
const srtSprite = new OffscreenSprite( const srtSprite = new OffscreenSprite(
@@ -62,7 +61,7 @@ export const useVideoSubtitleEmbedding = async (
}) })
); );
await srtSprite.ready; await srtSprite.ready;
srtSprite.time = { duration: 10e6, offset: 0 }; srtSprite.time = { duration: videoClip.meta.duration, offset: 0 }
const combinator = new Combinator({ const combinator = new Combinator({
width: 1920, width: 1920,