Skip to content
This repository was archived by the owner on Nov 27, 2024. It is now read-only.

Commit 45a39fa

Browse files
committed
If promptOptions.VideoInputFPS and promptOptions.VideoOutputFPS are not set, set them to the values of the InputVIdeo�Removed bug checking promptOptions.InputVideo.VideoFrames is not null twice
1 parent 86f7c31 commit 45a39fa

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

OnnxStack.StableDiffusion/Services/StableDiffusionService.cs

+11-4
Original file line numberDiff line numberDiff line change
@@ -333,12 +333,19 @@ private async Task GenerateInputVideoFrames(PromptOptions promptOptions, Action<
333333
if (!promptOptions.HasInputVideo || promptOptions.InputVideo.VideoFrames is not null)
334334
return;
335335

336-
// Already has VideoFrames
337-
if (promptOptions.InputVideo.VideoFrames is not null)
338-
return;
336+
if (promptOptions.VideoInputFPS == 0 || promptOptions.VideoOutputFPS == 0)
337+
{
338+
var videoInfo = await _videoService.GetVideoInfoAsync(promptOptions.InputVideo);
339+
if (promptOptions.VideoInputFPS == 0)
340+
promptOptions.VideoInputFPS = videoInfo.FPS;
341+
342+
if (promptOptions.VideoOutputFPS == 0)
343+
promptOptions.VideoOutputFPS = videoInfo.FPS;
344+
}
339345

346+
var videoFrame = await _videoService.CreateFramesAsync(promptOptions.InputVideo, promptOptions.VideoInputFPS);
340347
progress?.Invoke(new DiffusionProgress($"Generating video frames @ {promptOptions.VideoInputFPS}fps"));
341-
promptOptions.InputVideo.VideoFrames = await _videoService.CreateFramesAsync(promptOptions.InputVideo, promptOptions.VideoInputFPS);
348+
promptOptions.InputVideo.VideoFrames = videoFrame;
342349
}
343350
}
344351
}

0 commit comments

Comments
 (0)