1+ using ScreenToGif . Domain . Enums ;
2+ using ScreenToGif . Domain . Interfaces ;
3+ using ScreenToGif . ViewModel . ExportPresets . AnimatedImage . Webp ;
4+ using System . Runtime . Serialization ;
5+
6+ namespace ScreenToGif . ViewModel . ExportPresets . AnimatedImage . Avif ;
7+
8+ public class FfmpegAvifPreset : AvifPreset , IFfmpegPreset
9+ {
10+ private VideoSettingsModes _settingsMode = VideoSettingsModes . Normal ;
11+ private string _parameters = "-vsync passthrough \n {I} \n -c:v libaom-av1 \n -quality 75 \n -loop 0 \n -f avif \n {O}" ;
12+ private VideoCodecPresets _codecPreset = VideoCodecPresets . Default ;
13+ private int _quality = 75 ; // A lower value may be better for the default
14+ private VideoCodecs _videoCodec = VideoCodecs . LibAom ;
15+ private HardwareAccelerationModes _hardwareAcceleration = HardwareAccelerationModes . Auto ;
16+ private VideoPixelFormats _pixelFormat = VideoPixelFormats . Auto ;
17+ private Framerates _framerate = Framerates . Auto ;
18+ private double _customFramerate = 25d ;
19+ private Vsyncs _vsync = Vsyncs . Passthrough ;
20+
21+ public VideoSettingsModes SettingsMode
22+ {
23+ get => _settingsMode ;
24+ set => SetProperty ( ref _settingsMode , value ) ;
25+ }
26+
27+ [ DataMember ( EmitDefaultValue = false ) ]
28+ public string Parameters
29+ {
30+ get => _parameters ;
31+ set => SetProperty ( ref _parameters , value ) ;
32+ }
33+
34+ public VideoCodecPresets CodecPreset
35+ {
36+ get => _codecPreset ;
37+ set => SetProperty ( ref _codecPreset , value ) ;
38+ }
39+
40+ public int Quality
41+ {
42+ get => _quality ;
43+ set => SetProperty ( ref _quality , value ) ;
44+ }
45+
46+ public VideoCodecs VideoCodec
47+ {
48+ get => _videoCodec ;
49+ set => SetProperty ( ref _videoCodec , value ) ;
50+ }
51+
52+ public HardwareAccelerationModes HardwareAcceleration
53+ {
54+ get => _hardwareAcceleration ;
55+ set => SetProperty ( ref _hardwareAcceleration , value ) ;
56+ }
57+
58+ public VideoPixelFormats PixelFormat
59+ {
60+ get => _pixelFormat ;
61+ set => SetProperty ( ref _pixelFormat , value ) ;
62+ }
63+
64+ public Framerates Framerate
65+ {
66+ get => _framerate ;
67+ set => SetProperty ( ref _framerate , value ) ;
68+ }
69+
70+ public double CustomFramerate
71+ {
72+ get => _customFramerate ;
73+ set => SetProperty ( ref _customFramerate , value ) ;
74+ }
75+
76+ public Vsyncs Vsync
77+ {
78+ get => _vsync ;
79+ set => SetProperty ( ref _vsync , value ) ;
80+ }
81+
82+
83+ public FfmpegAvifPreset ( )
84+ {
85+ Encoder = EncoderTypes . FFmpeg ;
86+ ImageId = "Vector.Ffmpeg" ;
87+ IsEncoderExpanded = false ;
88+ RequiresFfmpeg = true ;
89+ }
90+
91+ public static List < FfmpegAvifPreset > Defaults => new ( )
92+ {
93+ new FfmpegAvifPreset
94+ {
95+ TitleKey = "S.Preset.Default.Title" ,
96+ DescriptionKey = "S.Preset.Default.Description" ,
97+ HasAutoSave = true ,
98+ IsSelectedForEncoder = true ,
99+ IsDefault = true ,
100+ CreationDate = new DateTime ( 2024 , 09 , 18 )
101+ } ,
102+ } ;
103+ }
0 commit comments