mirror of
https://github.com/n00mkrad/flowframes.git
synced 2026-07-11 21:11:00 +02:00
Added NVENC support for h264/h265
This commit is contained in:
@@ -9,15 +9,18 @@ namespace Flowframes.AudioVideo
|
||||
{
|
||||
class FFmpegUtils
|
||||
{
|
||||
public enum Codec { H264, H265, VP9, ProRes, AviRaw }
|
||||
public enum Codec { H264, H265, NVENC264, NVENC265, VP9, ProRes, AviRaw }
|
||||
|
||||
|
||||
public static Codec GetCodec(Interpolate.OutMode mode)
|
||||
{
|
||||
if (mode == Interpolate.OutMode.VidMp4)
|
||||
{
|
||||
bool h265 = Config.GetInt("mp4Enc") == 1;
|
||||
return h265 ? Codec.H265 : Codec.H264;
|
||||
int mp4Enc = Config.GetInt("mp4Enc");
|
||||
if (mp4Enc == 0) return Codec.H264;
|
||||
if (mp4Enc == 1) return Codec.H265;
|
||||
if (mp4Enc == 2) return Codec.NVENC264;
|
||||
if (mp4Enc == 3) return Codec.NVENC265;
|
||||
}
|
||||
|
||||
if (mode == Interpolate.OutMode.VidWebm)
|
||||
@@ -38,6 +41,8 @@ namespace Flowframes.AudioVideo
|
||||
{
|
||||
case Codec.H264: return "libx264";
|
||||
case Codec.H265: return "libx265";
|
||||
case Codec.NVENC264: return "h264_nvenc";
|
||||
case Codec.NVENC265: return "hevc_nvenc";
|
||||
case Codec.VP9: return "libvpx-vp9";
|
||||
case Codec.ProRes: return "prores_ks";
|
||||
case Codec.AviRaw: return Config.Get("aviCodec");
|
||||
@@ -59,6 +64,16 @@ namespace Flowframes.AudioVideo
|
||||
args += $"-crf {Config.GetInt("h265Crf")} -preset {Config.Get("ffEncPreset")} -pix_fmt yuv420p";
|
||||
}
|
||||
|
||||
if (codec == Codec.NVENC264)
|
||||
{
|
||||
args += $"-crf {Config.GetInt("h264Crf")} -preset default -pix_fmt yuv420p";
|
||||
}
|
||||
|
||||
if (codec == Codec.NVENC265)
|
||||
{
|
||||
args += $"-crf {Config.GetInt("h265Crf")} -preset default -pix_fmt yuv420p";
|
||||
}
|
||||
|
||||
if (codec == Codec.VP9)
|
||||
{
|
||||
int crf = Config.GetInt("vp9Crf");
|
||||
|
||||
4
Code/Forms/SettingsForm.Designer.cs
generated
4
Code/Forms/SettingsForm.Designer.cs
generated
@@ -1462,7 +1462,9 @@
|
||||
this.mp4Enc.FormattingEnabled = true;
|
||||
this.mp4Enc.Items.AddRange(new object[] {
|
||||
"h264 - Fast, good compatibility, medium quality per filesize",
|
||||
"h265 - Slower, mixed compatibility, very good quality per filesize"});
|
||||
"h265 - Slower, mixed compatibility, very good quality per filesize",
|
||||
"h264 NVENC - GPU-accelerated encoding, worse compression than h264",
|
||||
"h265 NVENC - GPU-accelerated encoding, worse compression than h265"});
|
||||
this.mp4Enc.Location = new System.Drawing.Point(280, 207);
|
||||
this.mp4Enc.Name = "mp4Enc";
|
||||
this.mp4Enc.Size = new System.Drawing.Size(400, 21);
|
||||
|
||||
Reference in New Issue
Block a user