1- using OnnxStack . Core . Services ;
2- using OnnxStack . Core . Video ;
3- using OnnxStack . StableDiffusion . Common ;
1+ using OnnxStack . Core . Video ;
42using OnnxStack . StableDiffusion . Config ;
53using OnnxStack . StableDiffusion . Enums ;
64using OnnxStack . StableDiffusion . Pipelines ;
@@ -11,12 +9,10 @@ public sealed class VideoToVideoExample : IExampleRunner
119 {
1210 private readonly string _outputDirectory ;
1311 private readonly StableDiffusionConfig _configuration ;
14- private readonly IVideoService _videoService ;
1512
16- public VideoToVideoExample ( StableDiffusionConfig configuration , IVideoService videoService )
13+ public VideoToVideoExample ( StableDiffusionConfig configuration )
1714 {
1815 _configuration = configuration ;
19- _videoService = videoService ;
2016 _outputDirectory = Path . Combine ( Directory . GetCurrentDirectory ( ) , "Examples" , nameof ( VideoToVideoExample ) ) ;
2117 Directory . CreateDirectory ( _outputDirectory ) ;
2218 }
@@ -30,8 +26,7 @@ public VideoToVideoExample(StableDiffusionConfig configuration, IVideoService vi
3026 public async Task RunAsync ( )
3127 {
3228 // Load Video
33- var targetFPS = 15 ;
34- var videoInput = await VideoInput . FromFileAsync ( "C:\\ Users\\ Deven\\ Pictures\\ gidsgphy.gif" , targetFPS ) ;
29+ var videoInput = await OnnxVideo . FromFileAsync ( "C:\\ Users\\ Deven\\ Pictures\\ gidsgphy.gif" ) ;
3530
3631 // Loop though the appsettings.json model sets
3732 foreach ( var modelSet in _configuration . ModelSets )
@@ -53,11 +48,10 @@ public async Task RunAsync()
5348 } ;
5449
5550 // Run pipeline
56- var result = await pipeline . RunAsync ( promptOptions , progressCallback : OutputHelpers . FrameProgressCallback ) ;
51+ var result = await pipeline . GenerateVideoAsync ( promptOptions , progressCallback : OutputHelpers . FrameProgressCallback ) ;
5752
5853 // Save Video File
59- var outputFilename = Path . Combine ( _outputDirectory , $ "{ modelSet . Name } .mp4") ;
60- await VideoInput . SaveFileAsync ( result , outputFilename , targetFPS ) ;
54+ await result . SaveAsync ( Path . Combine ( _outputDirectory , $ "Result.mp4") ) ;
6155 }
6256 }
6357 }
0 commit comments