增加导出时输出ffmpeg参数

This commit is contained in:
ww-rm
2025-03-29 23:48:56 +08:00
parent c111819093
commit d859f07469

View File

@@ -8,6 +8,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using FFMpegCore.Arguments; using FFMpegCore.Arguments;
using System.Diagnostics;
namespace SpineViewer.Exporter.Implementations.Exporter namespace SpineViewer.Exporter.Implementations.Exporter
{ {
@@ -30,12 +31,14 @@ namespace SpineViewer.Exporter.Implementations.Exporter
var videoFramesSource = new RawVideoPipeSource(GetFrames(spinesToRender, worker)) { FrameRate = args.FPS }; var videoFramesSource = new RawVideoPipeSource(GetFrames(spinesToRender, worker)) { FrameRate = args.FPS };
try try
{ {
FFMpegArguments var ffmpegArgs = FFMpegArguments
.FromPipeInput(videoFramesSource) .FromPipeInput(videoFramesSource)
.OutputToFile(savePath, true, options => options .OutputToFile(savePath, true, options => options
.ForceFormat("gif") .ForceFormat("gif")
.WithCustomArgument(args.FFMpegCoreCustomArguments)) .WithCustomArgument(args.FFMpegCoreCustomArguments));
.ProcessSynchronously();
logger.Info("FFMpeg arguments: {}", ffmpegArgs.Arguments);
ffmpegArgs.ProcessSynchronously();
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -58,12 +61,14 @@ namespace SpineViewer.Exporter.Implementations.Exporter
var videoFramesSource = new RawVideoPipeSource(GetFrames(spine, worker)) { FrameRate = args.FPS }; var videoFramesSource = new RawVideoPipeSource(GetFrames(spine, worker)) { FrameRate = args.FPS };
try try
{ {
FFMpegArguments var ffmpegArgs = FFMpegArguments
.FromPipeInput(videoFramesSource) .FromPipeInput(videoFramesSource)
.OutputToFile(savePath, true, options => options .OutputToFile(savePath, true, options => options
.ForceFormat("gif") .ForceFormat("gif")
.WithCustomArgument(args.FFMpegCoreCustomArguments)) .WithCustomArgument(args.FFMpegCoreCustomArguments));
.ProcessSynchronously();
logger.Info("FFMpeg arguments: {}", ffmpegArgs.Arguments);
ffmpegArgs.ProcessSynchronously();
} }
catch (Exception ex) catch (Exception ex)
{ {