56 lines
1.5 KiB
C#
56 lines
1.5 KiB
C#
using FFMpegCore;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace SpineViewer.Exporter
|
|
{
|
|
/// <summary>
|
|
/// MP4 导出参数
|
|
/// </summary>
|
|
public class AvifExporter : FFmpegVideoExporter
|
|
{
|
|
public AvifExporter()
|
|
{
|
|
FPS = 24;
|
|
}
|
|
|
|
public override string Format => "avif";
|
|
|
|
public override string Suffix => ".avif";
|
|
|
|
/// <summary>
|
|
/// 编码器
|
|
/// </summary>
|
|
public string Codec { get; set; } = "av1_nvenc";
|
|
|
|
/// <summary>
|
|
/// CRF
|
|
/// </summary>
|
|
public int CRF { get => crf; set => crf = Math.Clamp(value, 0, 63); }
|
|
private int crf = 23;
|
|
|
|
/// <summary>
|
|
/// 像素格式
|
|
/// </summary>
|
|
public string PixelFormat { get; set; } = "yuv420p";
|
|
|
|
/// <summary>
|
|
/// 循环次数, 0 无限循环, 取值范围 [0, 65535]
|
|
/// </summary>
|
|
public int Loop { get => loop; set => loop = Math.Clamp(value, 0, 65535); }
|
|
private int loop = 0;
|
|
|
|
public override string FileNameNoteSuffix => $"{Codec}_{CRF}_{PixelFormat}";
|
|
|
|
public override void SetOutputOptions(FFMpegArgumentOptions options)
|
|
{
|
|
base.SetOutputOptions(options);
|
|
options.WithVideoCodec(Codec).ForcePixelFormat(PixelFormat).WithConstantRateFactor(CRF).WithCustomArgument($"-loop {Loop}");
|
|
}
|
|
}
|
|
}
|