apng和mov格式参数改为枚举量类型
This commit is contained in:
@@ -35,6 +35,33 @@ namespace Spine.Exporters
|
|||||||
Mov,
|
Mov,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Apng 格式预测器算法
|
||||||
|
/// </summary>
|
||||||
|
public enum ApngPredMethod
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
Sub = 1,
|
||||||
|
Up = 2,
|
||||||
|
Avg = 3,
|
||||||
|
Paeth = 4,
|
||||||
|
Mixed = 5,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Mov prores_ks 编码器 profile 参数
|
||||||
|
/// </summary>
|
||||||
|
public enum MovProfile
|
||||||
|
{
|
||||||
|
Auto = -1,
|
||||||
|
Proxy = 0,
|
||||||
|
Light = 1,
|
||||||
|
Standard = 2,
|
||||||
|
High = 3,
|
||||||
|
Yuv4444 = 4,
|
||||||
|
Yuv4444Extreme = 5,
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 视频格式
|
/// 视频格式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -60,10 +87,10 @@ namespace Spine.Exporters
|
|||||||
private bool _lossless = false;
|
private bool _lossless = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// [Apng] 预测器算法, 取值范围 0-5, 分别对应 none, sub, up, avg, paeth, mixed
|
/// [Apng] 预测器算法
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int PredMethod { get => _predMethod; set => _predMethod = Math.Clamp(value, 0, 5); }
|
public ApngPredMethod PredMethod { get => _predMethod; set => _predMethod = value; }
|
||||||
private int _predMethod = 5;
|
private ApngPredMethod _predMethod = ApngPredMethod.Mixed;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// [Mp4/Webm/Mkv] CRF
|
/// [Mp4/Webm/Mkv] CRF
|
||||||
@@ -72,10 +99,10 @@ namespace Spine.Exporters
|
|||||||
private int _crf = 23;
|
private int _crf = 23;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// [Mov] prores_ks 编码器的配置等级, -1 是自动, 越高质量越好, 只有 4 及以上才有透明通道
|
/// [Mov] prores_ks 编码器的配置等级, 越高质量越好, 只有 <see cref="MovProfile.Yuv4444"> 及以上才有透明通道
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Profile { get => _profile; set => _profile = Math.Clamp(value, -1, 5); }
|
public MovProfile Profile { get => _profile; set => _profile = value; }
|
||||||
private int _profile = 5;
|
private MovProfile _profile = MovProfile.Yuv4444Extreme;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取的一帧, 结果是预乘的
|
/// 获取的一帧, 结果是预乘的
|
||||||
@@ -142,7 +169,7 @@ namespace Spine.Exporters
|
|||||||
|
|
||||||
private void SetApngOptions(FFMpegArgumentOptions options)
|
private void SetApngOptions(FFMpegArgumentOptions options)
|
||||||
{
|
{
|
||||||
var customArgs = $"-vf unpremultiply=inplace=1 -plays {(_loop ? 0 : 1)} -pred {_predMethod}";
|
var customArgs = $"-vf unpremultiply=inplace=1 -plays {(_loop ? 0 : 1)} -pred {(int)_predMethod}";
|
||||||
options.ForceFormat("apng").WithVideoCodec("apng").ForcePixelFormat("rgba")
|
options.ForceFormat("apng").WithVideoCodec("apng").ForcePixelFormat("rgba")
|
||||||
.WithCustomArgument(customArgs);
|
.WithCustomArgument(customArgs);
|
||||||
}
|
}
|
||||||
@@ -179,7 +206,7 @@ namespace Spine.Exporters
|
|||||||
var customArgs = "-vf unpremultiply=inplace=1";
|
var customArgs = "-vf unpremultiply=inplace=1";
|
||||||
options.ForceFormat("mov").WithVideoCodec("prores_ks").ForcePixelFormat("yuva444p10le")
|
options.ForceFormat("mov").WithVideoCodec("prores_ks").ForcePixelFormat("yuva444p10le")
|
||||||
.WithFastStart()
|
.WithFastStart()
|
||||||
.WithCustomArgument($"-profile {_profile}")
|
.WithCustomArgument($"-profile {(int)_profile}")
|
||||||
.WithCustomArgument(customArgs);
|
.WithCustomArgument(customArgs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -211,7 +211,7 @@
|
|||||||
<s:String x:Key="Str_CrfParameter">CRF Parameter</s:String>
|
<s:String x:Key="Str_CrfParameter">CRF Parameter</s:String>
|
||||||
<s:String x:Key="Str_CrfParameterTooltip" xml:space="preserve">[Mp4/Webm/Mkv]
CRF parameter, range 0-63, lower value means higher quality</s:String>
|
<s:String x:Key="Str_CrfParameterTooltip" xml:space="preserve">[Mp4/Webm/Mkv]
CRF parameter, range 0-63, lower value means higher quality</s:String>
|
||||||
<s:String x:Key="Str_ProfileParameter">Profile Parameter</s:String>
|
<s:String x:Key="Str_ProfileParameter">Profile Parameter</s:String>
|
||||||
<s:String x:Key="Str_ProfileParameterTooltip" xml:space="preserve">[Mov]
Profile parameter, integer between -1 and 5,
-1 means automatic, higher values indicate higher quality,
Alpha channel encoding is only available when value is 4 or higher</s:String>
|
<s:String x:Key="Str_ProfileParameterTooltip" xml:space="preserve">[Mov]
Profile parameter, an integer between -1 and 5,
corresponding to: auto, proxy, lt, standard, hq, 4444, and 4444xq.
Alpha channel encoding is available only when the value is 4 or higher.</s:String>
|
||||||
|
|
||||||
<s:String x:Key="Str_FFmpegFormat">Export Format</s:String>
|
<s:String x:Key="Str_FFmpegFormat">Export Format</s:String>
|
||||||
<s:String x:Key="Str_FFmpegFormatTooltip">FFmpeg export format (equivalent to "-f"), e.g. "mp4", "webm"</s:String>
|
<s:String x:Key="Str_FFmpegFormatTooltip">FFmpeg export format (equivalent to "-f"), e.g. "mp4", "webm"</s:String>
|
||||||
|
|||||||
@@ -211,7 +211,7 @@
|
|||||||
<s:String x:Key="Str_CrfParameter">CRF パラメータ</s:String>
|
<s:String x:Key="Str_CrfParameter">CRF パラメータ</s:String>
|
||||||
<s:String x:Key="Str_CrfParameterTooltip" xml:space="preserve">[Mp4/Webm/Mkv]
CRF パラメータ、範囲0-63。値が小さいほど品質が高い</s:String>
|
<s:String x:Key="Str_CrfParameterTooltip" xml:space="preserve">[Mp4/Webm/Mkv]
CRF パラメータ、範囲0-63。値が小さいほど品質が高い</s:String>
|
||||||
<s:String x:Key="Str_ProfileParameter">プロファイルパラメータ</s:String>
|
<s:String x:Key="Str_ProfileParameter">プロファイルパラメータ</s:String>
|
||||||
<s:String x:Key="Str_ProfileParameterTooltip" xml:space="preserve">[Mov]
プロファイルパラメータ、-1から5の整数、
-1は自動、値が大きいほど品質が高い、
値が4以上の場合のみアルファチャンネルをエンコード可能</s:String>
|
<s:String x:Key="Str_ProfileParameterTooltip" xml:space="preserve">[Mov]
Profile パラメータ。値は -1 ~ 5 の整数で、
それぞれ auto、proxy、lt、standard、hq、4444、4444xq に対応します。
値が 4 以上の場合のみアルファチャンネルのエンコードが可能です。</s:String>
|
||||||
|
|
||||||
<s:String x:Key="Str_FFmpegFormat">エクスポートフォーマット</s:String>
|
<s:String x:Key="Str_FFmpegFormat">エクスポートフォーマット</s:String>
|
||||||
<s:String x:Key="Str_FFmpegFormatTooltip">FFmpegエクスポートフォーマット。パラメーター“-f”に相当します。例: “mp4”、“webm”</s:String>
|
<s:String x:Key="Str_FFmpegFormatTooltip">FFmpegエクスポートフォーマット。パラメーター“-f”に相当します。例: “mp4”、“webm”</s:String>
|
||||||
|
|||||||
@@ -211,7 +211,7 @@
|
|||||||
<s:String x:Key="Str_CrfParameter">CRF 参数</s:String>
|
<s:String x:Key="Str_CrfParameter">CRF 参数</s:String>
|
||||||
<s:String x:Key="Str_CrfParameterTooltip" xml:space="preserve">[Mp4/Webm/Mkv]
CRF 参数,取值范围 0-63,越小质量越高</s:String>
|
<s:String x:Key="Str_CrfParameterTooltip" xml:space="preserve">[Mp4/Webm/Mkv]
CRF 参数,取值范围 0-63,越小质量越高</s:String>
|
||||||
<s:String x:Key="Str_ProfileParameter">Profile 参数</s:String>
|
<s:String x:Key="Str_ProfileParameter">Profile 参数</s:String>
|
||||||
<s:String x:Key="Str_ProfileParameterTooltip" xml:space="preserve">[Mov]
Profile 参数,取值集合为 -1 到 5 之间的整数,
-1 表示自动,0-5 取值越高质量越高,
仅在取值大于等于 4 时可以编码透明度通道</s:String>
|
<s:String x:Key="Str_ProfileParameterTooltip" xml:space="preserve">[Mov]
Profile 参数,取值范围为 -1 到 5 之间的整数,
分别对应 auto、proxy、lt、standard、hq、4444、4444xq 几种配置,
仅在取值大于等于 4 时可以编码透明度通道</s:String>
|
||||||
|
|
||||||
<s:String x:Key="Str_FFmpegFormat">导出格式</s:String>
|
<s:String x:Key="Str_FFmpegFormat">导出格式</s:String>
|
||||||
<s:String x:Key="Str_FFmpegFormatTooltip">FFmpeg 导出格式,等价于参数 “-f”,例如 “mp4”、“webm”</s:String>
|
<s:String x:Key="Str_FFmpegFormatTooltip">FFmpeg 导出格式,等价于参数 “-f”,例如 “mp4”、“webm”</s:String>
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ namespace SpineViewer.ViewModels.Exporters
|
|||||||
public class FFmpegVideoExporterViewModel(MainWindowViewModel vmMain) : VideoExporterViewModel(vmMain)
|
public class FFmpegVideoExporterViewModel(MainWindowViewModel vmMain) : VideoExporterViewModel(vmMain)
|
||||||
{
|
{
|
||||||
public static ImmutableArray<FFmpegVideoExporter.VideoFormat> VideoFormatOptions { get; } = Enum.GetValues<FFmpegVideoExporter.VideoFormat>().ToImmutableArray();
|
public static ImmutableArray<FFmpegVideoExporter.VideoFormat> VideoFormatOptions { get; } = Enum.GetValues<FFmpegVideoExporter.VideoFormat>().ToImmutableArray();
|
||||||
|
public static ImmutableArray<FFmpegVideoExporter.ApngPredMethod> ApngPredMethodOptions { get; } = Enum.GetValues<FFmpegVideoExporter.ApngPredMethod>().ToImmutableArray();
|
||||||
|
public static ImmutableArray<FFmpegVideoExporter.MovProfile> MovProfileOptions { get; } = Enum.GetValues<FFmpegVideoExporter.MovProfile>().ToImmutableArray();
|
||||||
|
|
||||||
public FFmpegVideoExporter.VideoFormat Format
|
public FFmpegVideoExporter.VideoFormat Format
|
||||||
{
|
{
|
||||||
@@ -57,8 +59,8 @@ namespace SpineViewer.ViewModels.Exporters
|
|||||||
public bool EnableParamLossless =>
|
public bool EnableParamLossless =>
|
||||||
_format == FFmpegVideoExporter.VideoFormat.Webp;
|
_format == FFmpegVideoExporter.VideoFormat.Webp;
|
||||||
|
|
||||||
public int PredMethod { get => _predMethod; set => SetProperty(ref _predMethod, Math.Clamp(value, 0, 5)); }
|
public FFmpegVideoExporter.ApngPredMethod PredMethod { get => _predMethod; set => SetProperty(ref _predMethod, value); }
|
||||||
protected int _predMethod = 5;
|
protected FFmpegVideoExporter.ApngPredMethod _predMethod = FFmpegVideoExporter.ApngPredMethod.Mixed;
|
||||||
|
|
||||||
public bool EnableParamApngPred =>
|
public bool EnableParamApngPred =>
|
||||||
_format == FFmpegVideoExporter.VideoFormat.Apng;
|
_format == FFmpegVideoExporter.VideoFormat.Apng;
|
||||||
@@ -71,8 +73,8 @@ namespace SpineViewer.ViewModels.Exporters
|
|||||||
_format == FFmpegVideoExporter.VideoFormat.Webm ||
|
_format == FFmpegVideoExporter.VideoFormat.Webm ||
|
||||||
_format == FFmpegVideoExporter.VideoFormat.Mkv;
|
_format == FFmpegVideoExporter.VideoFormat.Mkv;
|
||||||
|
|
||||||
public int Profile { get => _profile; set => SetProperty(ref _profile, Math.Clamp(value, -1, 5)); }
|
public FFmpegVideoExporter.MovProfile Profile { get => _profile; set => SetProperty(ref _profile, value); }
|
||||||
protected int _profile = 5;
|
protected FFmpegVideoExporter.MovProfile _profile = FFmpegVideoExporter.MovProfile.Yuv4444Extreme;
|
||||||
|
|
||||||
public bool EnableParamProfile =>
|
public bool EnableParamProfile =>
|
||||||
_format == FFmpegVideoExporter.VideoFormat.Mov;
|
_format == FFmpegVideoExporter.VideoFormat.Mov;
|
||||||
|
|||||||
@@ -248,7 +248,10 @@
|
|||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Label Content="{DynamicResource Str_PredMethod}" ToolTip="{DynamicResource Str_PredMethodTooltip}"/>
|
<Label Content="{DynamicResource Str_PredMethod}" ToolTip="{DynamicResource Str_PredMethodTooltip}"/>
|
||||||
<TextBox Grid.Column="1" Text="{Binding PredMethod}" ToolTip="{DynamicResource Str_PredMethodTooltip}"/>
|
<ComboBox Grid.Column="1"
|
||||||
|
SelectedItem="{Binding PredMethod}"
|
||||||
|
ItemsSource="{x:Static vmexp:FFmpegVideoExporterViewModel.ApngPredMethodOptions}"
|
||||||
|
ToolTip="{DynamicResource Str_PredMethodTooltip}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- CRF 参数 -->
|
<!-- CRF 参数 -->
|
||||||
@@ -268,7 +271,10 @@
|
|||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Label Content="{DynamicResource Str_ProfileParameter}" ToolTip="{DynamicResource Str_ProfileParameterTooltip}"/>
|
<Label Content="{DynamicResource Str_ProfileParameter}" ToolTip="{DynamicResource Str_ProfileParameterTooltip}"/>
|
||||||
<TextBox Grid.Column="1" Text="{Binding Profile}" ToolTip="{DynamicResource Str_ProfileParameterTooltip}"/>
|
<ComboBox Grid.Column="1"
|
||||||
|
SelectedItem="{Binding Profile}"
|
||||||
|
ItemsSource="{x:Static vmexp:FFmpegVideoExporterViewModel.MovProfileOptions}"
|
||||||
|
ToolTip="{DynamicResource Str_ProfileParameterTooltip}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
|
|||||||
Reference in New Issue
Block a user