diff --git a/Spine/Exporters/FFmpegVideoExporter.cs b/Spine/Exporters/FFmpegVideoExporter.cs
index 744b899..cce74c7 100644
--- a/Spine/Exporters/FFmpegVideoExporter.cs
+++ b/Spine/Exporters/FFmpegVideoExporter.cs
@@ -51,6 +51,12 @@ namespace Spine.Exporters
public int Quality { get => _quality; set => _quality = Math.Clamp(value, 0, 100); }
private int _quality = 75;
+ ///
+ /// 无损压缩 (Webp)
+ ///
+ public bool Lossless { get => _lossless; set => _lossless = value; }
+ private bool _lossless = false;
+
///
/// CRF
///
@@ -62,7 +68,8 @@ namespace Spine.Exporters
///
protected override SFMLImageVideoFrame GetFrame(SpineObject[] spines)
{
- // BUG: 不知道为什么用 FFmpeg 必须临时创建 RenderTexture, 否则无法正常渲染
+ // BUG: 也许和 SFML 多线程或者 FFmpeg 调用有关, 当渲染线程也在运行的时候此处并行渲染会导致和 SFML 有关的内容都卡死
+ // 不知道为什么用 FFmpeg 必须临时创建 RenderTexture, 否则无法正常渲染, 会导致画面帧丢失
using var tex = new RenderTexture(_renderTexture.Size.X, _renderTexture.Size.Y);
using var view = _renderTexture.GetView();
tex.SetView(view);
@@ -112,7 +119,7 @@ namespace Spine.Exporters
private void SetWebpOptions(FFMpegArgumentOptions options)
{
- var customArgs = $"-vf unpremultiply=inplace=1 -quality {_quality} -loop {(_loop ? 0 : 1)}";
+ var customArgs = $"-vf unpremultiply=inplace=1 -quality {_quality} -loop {(_loop ? 0 : 1)} -lossless {(_lossless ? 1 : 0)}";
options.ForceFormat("webp").WithVideoCodec("libwebp_anim").ForcePixelFormat("yuva420p")
.WithCustomArgument(customArgs);
}
diff --git a/SpineViewer/Resources/Strings/en.xaml b/SpineViewer/Resources/Strings/en.xaml
index cadde50..34e67ef 100644
--- a/SpineViewer/Resources/Strings/en.xaml
+++ b/SpineViewer/Resources/Strings/en.xaml
@@ -174,6 +174,8 @@
Loop animation; only effective for GIF/WebP formats
Quality Parameter
Range 0–100; higher is better; only for WebP format
+ Lossless Compression
+ Lossless compression. Ignores the quality parameter and only applies to WebP format.
CRF Parameter
Range 0–63; lower is higher quality; only for MP4/WebM/MKV formats
diff --git a/SpineViewer/Resources/Strings/ja.xaml b/SpineViewer/Resources/Strings/ja.xaml
index 83a119a..f3c1b3d 100644
--- a/SpineViewer/Resources/Strings/ja.xaml
+++ b/SpineViewer/Resources/Strings/ja.xaml
@@ -174,6 +174,8 @@
アニメーションをループ再生するか。Gif/Webp形式のみ有効です
品質パラメーター
品質パラメーター。値の範囲は0-100。数値が大きいほど品質が高くなります。Webp形式のみ有効です
+ 可逆圧縮
+ 可逆圧縮を行います。品質パラメータは無視され、WebP形式にのみ適用されます。
CRFパラメーター
CRFパラメーター。値の範囲は0-63。数値が小さいほど品質が高くなります。Mp4/Webm/Mkv形式のみ有効です
diff --git a/SpineViewer/Resources/Strings/zh.xaml b/SpineViewer/Resources/Strings/zh.xaml
index 983b8e4..53c90de 100644
--- a/SpineViewer/Resources/Strings/zh.xaml
+++ b/SpineViewer/Resources/Strings/zh.xaml
@@ -173,7 +173,9 @@
循环播放
动图是否循环播放,仅对 Gif/Webp 格式生效
质量参数
- 质量参数,取值范围 0-100,越高质量越好 仅对 Webp 格式生效
+ 质量参数,取值范围 0-100,越高质量越好, 仅对 Webp 格式生效
+ 无损压缩
+ 无损压缩, 会忽略质量参数, 仅对 Webp 格式生效
CRF 参数
CRF 参数,取值范围 0-63,越小质量越高,仅对 Mp4/Webm/Mkv 格式生效
diff --git a/SpineViewer/ViewModels/Exporters/FFmpegVideoExporterViewModel.cs b/SpineViewer/ViewModels/Exporters/FFmpegVideoExporterViewModel.cs
index 779c134..37471ff 100644
--- a/SpineViewer/ViewModels/Exporters/FFmpegVideoExporterViewModel.cs
+++ b/SpineViewer/ViewModels/Exporters/FFmpegVideoExporterViewModel.cs
@@ -29,6 +29,9 @@ namespace SpineViewer.ViewModels.Exporters
public int Quality { get => _quality; set => SetProperty(ref _quality, Math.Clamp(value, 0, 100)); }
protected int _quality = 75;
+ public bool Lossless { get => _lossless; set => SetProperty(ref _lossless, value); }
+ protected bool _lossless = false;
+
public int Crf { get => _crf; set => SetProperty(ref _crf, Math.Clamp(value, 0, 63)); }
protected int _crf = 23;
@@ -55,6 +58,7 @@ namespace SpineViewer.ViewModels.Exporters
Format = _format,
Loop = _loop,
Quality = _quality,
+ Lossless = _lossless,
Crf = _crf
};
diff --git a/SpineViewer/Views/ExporterDialogs/FFmpegVideoExporterDialog.xaml b/SpineViewer/Views/ExporterDialogs/FFmpegVideoExporterDialog.xaml
index 4882b27..394d3a1 100644
--- a/SpineViewer/Views/ExporterDialogs/FFmpegVideoExporterDialog.xaml
+++ b/SpineViewer/Views/ExporterDialogs/FFmpegVideoExporterDialog.xaml
@@ -9,7 +9,7 @@
mc:Ignorable="d"
Title="{DynamicResource Str_FFmpegVideoExporterTitle}"
Width="450"
- Height="550"
+ Height="580"
ShowInTaskbar="False"
WindowStartupLocation="CenterOwner">
@@ -66,6 +66,7 @@
+
@@ -138,9 +139,13 @@
+
+
+
+
-
-
+
+