Add visual speed and source audio sync (#5)

This commit is contained in:
Martin Delophy authored and GitHub committed 2026-07-15 17:47:24 +08:00
1 parent e089bafab7
commit adecbe3f41
28 files changed
+662 -75

No files matched your search

+1 -1
View File
@@ -8,7 +8,7 @@ export function useSourceAudioExtraction(d) {
try {
const blob = await extractAudioFromVideo(asset.blob, asset.name); d.setStatusText("解析视频原声波形"); d.setProgress(78);
const decoded = await decodeWaveform(blob, 96); if (!decoded.duration) throw new Error("视频没有可识别的音频轨");
d.replaceSourceAudio(blob, decoded.duration, decoded.peaks, `${asset.name.replace(/\.[^.]+$/, "")} 原声.wav`, "视频原声已分离到时间线", timelineStart);
d.replaceSourceAudio(blob, decoded.duration, decoded.peaks, `${asset.name.replace(/\.[^.]+$/, "")} 原声.wav`, "视频原声已分离到时间线", timelineStart, asset.id);
} catch (error) {
console.warn(error); d.clearSourceAudioTrack(null); d.setStatus("ready"); d.setStatusText("视频未检测到可分离原声");
d.setProgress(0); d.notify("视频画面已添加,但没有可分离的原声音轨");