1
- using OnnxStack . Core . Services ;
2
- using OnnxStack . Core . Video ;
3
- using OnnxStack . StableDiffusion . Common ;
1
+ using OnnxStack . Core . Video ;
4
2
using OnnxStack . StableDiffusion . Config ;
5
3
using OnnxStack . StableDiffusion . Enums ;
6
4
using OnnxStack . StableDiffusion . Pipelines ;
@@ -11,12 +9,10 @@ public sealed class VideoToVideoExample : IExampleRunner
11
9
{
12
10
private readonly string _outputDirectory ;
13
11
private readonly StableDiffusionConfig _configuration ;
14
- private readonly IVideoService _videoService ;
15
12
16
- public VideoToVideoExample ( StableDiffusionConfig configuration , IVideoService videoService )
13
+ public VideoToVideoExample ( StableDiffusionConfig configuration )
17
14
{
18
15
_configuration = configuration ;
19
- _videoService = videoService ;
20
16
_outputDirectory = Path . Combine ( Directory . GetCurrentDirectory ( ) , "Examples" , nameof ( VideoToVideoExample ) ) ;
21
17
Directory . CreateDirectory ( _outputDirectory ) ;
22
18
}
@@ -30,8 +26,7 @@ public VideoToVideoExample(StableDiffusionConfig configuration, IVideoService vi
30
26
public async Task RunAsync ( )
31
27
{
32
28
// 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" ) ;
35
30
36
31
// Loop though the appsettings.json model sets
37
32
foreach ( var modelSet in _configuration . ModelSets )
@@ -53,11 +48,10 @@ public async Task RunAsync()
53
48
} ;
54
49
55
50
// Run pipeline
56
- var result = await pipeline . RunAsync ( promptOptions , progressCallback : OutputHelpers . FrameProgressCallback ) ;
51
+ var result = await pipeline . GenerateVideoAsync ( promptOptions , progressCallback : OutputHelpers . FrameProgressCallback ) ;
57
52
58
53
// 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") ) ;
61
55
}
62
56
}
63
57
}
0 commit comments