mirror of
https://github.com/ShareX/ShareX.git
synced 2024-06-30 20:20:34 +12:00
Added NVENC tune option
This commit is contained in:
parent
9e63193d0a
commit
51c471113d
|
@ -167,30 +167,32 @@ public enum FFmpegTune
|
|||
|
||||
public enum FFmpegNVENCPreset
|
||||
{
|
||||
[Description("Default")]
|
||||
@default,
|
||||
[Description("High quality 2 passes")]
|
||||
slow,
|
||||
[Description("High quality 1 pass")]
|
||||
medium,
|
||||
[Description("High performance 1 pass")]
|
||||
fast,
|
||||
[Description("High performance")]
|
||||
hp,
|
||||
[Description("Fastest (Lowest quality)")]
|
||||
p1,
|
||||
[Description("Faster (Lower quality)")]
|
||||
p2,
|
||||
[Description("Fast (Low quality)")]
|
||||
p3,
|
||||
[Description("Medium (Medium quality)")]
|
||||
p4,
|
||||
[Description("Slow (Good quality)")]
|
||||
p5,
|
||||
[Description("Slower (Better quality)")]
|
||||
p6,
|
||||
[Description("Slowest (Best quality)")]
|
||||
p7
|
||||
}
|
||||
|
||||
public enum FFmpegNVENCTune
|
||||
{
|
||||
[Description("High quality")]
|
||||
hq,
|
||||
[Description("Bluray disk")]
|
||||
bd,
|
||||
[Description("Low latency")]
|
||||
ll,
|
||||
[Description("Low latency high quality")]
|
||||
llhq,
|
||||
[Description("Low latency high performance")]
|
||||
llhp,
|
||||
[Description("Ultra low latency")]
|
||||
ull,
|
||||
[Description("Lossless")]
|
||||
lossless,
|
||||
[Description("Lossless high performance")]
|
||||
losslesshp
|
||||
lossless
|
||||
}
|
||||
|
||||
public enum FFmpegAMFUsage
|
||||
|
|
|
@ -106,6 +106,8 @@ private void InitializeComponent()
|
|||
this.cbUseCustomFFmpegPath = new System.Windows.Forms.CheckBox();
|
||||
this.lblVideoEncoder = new System.Windows.Forms.Label();
|
||||
this.lblAudioEncoder = new System.Windows.Forms.Label();
|
||||
this.lblNVENCTune = new System.Windows.Forms.Label();
|
||||
this.cbNVENCTune = new System.Windows.Forms.ComboBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nudx264CRF)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nudXvidQscale)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.tbVorbis_qscale)).BeginInit();
|
||||
|
@ -455,6 +457,8 @@ private void InitializeComponent()
|
|||
// tpNVENC
|
||||
//
|
||||
this.tpNVENC.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.tpNVENC.Controls.Add(this.cbNVENCTune);
|
||||
this.tpNVENC.Controls.Add(this.lblNVENCTune);
|
||||
this.tpNVENC.Controls.Add(this.lblNVENCBitrateK);
|
||||
this.tpNVENC.Controls.Add(this.cbNVENCPreset);
|
||||
this.tpNVENC.Controls.Add(this.lblNVENCPreset);
|
||||
|
@ -796,6 +800,19 @@ private void InitializeComponent()
|
|||
resources.ApplyResources(this.lblAudioEncoder, "lblAudioEncoder");
|
||||
this.lblAudioEncoder.Name = "lblAudioEncoder";
|
||||
//
|
||||
// lblNVENCTune
|
||||
//
|
||||
resources.ApplyResources(this.lblNVENCTune, "lblNVENCTune");
|
||||
this.lblNVENCTune.Name = "lblNVENCTune";
|
||||
//
|
||||
// cbNVENCTune
|
||||
//
|
||||
this.cbNVENCTune.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cbNVENCTune.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.cbNVENCTune, "cbNVENCTune");
|
||||
this.cbNVENCTune.Name = "cbNVENCTune";
|
||||
this.cbNVENCTune.SelectedIndexChanged += new System.EventHandler(this.cbNVENCTune_SelectedIndexChanged);
|
||||
//
|
||||
// FFmpegOptionsForm
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
|
@ -948,5 +965,7 @@ private void InitializeComponent()
|
|||
private System.Windows.Forms.Label lblAMFBitrateK;
|
||||
private System.Windows.Forms.NumericUpDown nudAMFBitrate;
|
||||
private System.Windows.Forms.Label lblAMFBitrate;
|
||||
private System.Windows.Forms.ComboBox cbNVENCTune;
|
||||
private System.Windows.Forms.Label lblNVENCTune;
|
||||
}
|
||||
}
|
|
@ -52,10 +52,11 @@ public FFmpegOptionsForm(ScreenRecordingOptions options)
|
|||
cbAudioCodec.Items.AddRange(Helpers.GetEnumDescriptions<FFmpegAudioCodec>());
|
||||
cbx264Preset.Items.AddRange(Helpers.GetEnumDescriptions<FFmpegPreset>());
|
||||
cbGIFStatsMode.Items.AddRange(Helpers.GetEnumDescriptions<FFmpegPaletteGenStatsMode>());
|
||||
cbNVENCPreset.Items.AddRange(Helpers.GetEnums<FFmpegNVENCPreset>().Select(x => $"{x} ({x.GetDescription()})").ToArray());
|
||||
cbNVENCPreset.Items.AddRange(Helpers.GetEnums<FFmpegNVENCPreset>().Select(x => $"{x} - {x.GetDescription()}").ToArray());
|
||||
cbNVENCTune.Items.AddRange(Helpers.GetEnums<FFmpegNVENCTune>().Select(x => $"{x} - {x.GetDescription()}").ToArray());
|
||||
cbGIFDither.Items.AddRange(Helpers.GetEnumDescriptions<FFmpegPaletteUseDither>());
|
||||
cbAMFUsage.Items.AddRange(Helpers.GetEnums<FFmpegAMFUsage>().Select(x => $"{x} ({x.GetDescription()})").ToArray());
|
||||
cbAMFQuality.Items.AddRange(Helpers.GetEnums<FFmpegAMFQuality>().Select(x => $"{x} ({x.GetDescription()})").ToArray());
|
||||
cbAMFUsage.Items.AddRange(Helpers.GetEnums<FFmpegAMFUsage>().Select(x => $"{x} - {x.GetDescription()}").ToArray());
|
||||
cbAMFQuality.Items.AddRange(Helpers.GetEnums<FFmpegAMFQuality>().Select(x => $"{x} - {x.GetDescription()}").ToArray());
|
||||
cbQSVPreset.Items.AddRange(Helpers.GetEnumDescriptions<FFmpegQSVPreset>());
|
||||
}
|
||||
|
||||
|
@ -96,6 +97,7 @@ private async Task SettingsLoad()
|
|||
// NVENC
|
||||
nudNVENCBitrate.SetValue(Options.FFmpeg.NVENC_Bitrate);
|
||||
cbNVENCPreset.SelectedIndex = (int)Options.FFmpeg.NVENC_Preset;
|
||||
cbNVENCTune.SelectedIndex = (int)Options.FFmpeg.NVENC_Tune;
|
||||
|
||||
// GIF
|
||||
cbGIFStatsMode.SelectedIndex = (int)Options.FFmpeg.GIFStatsMode;
|
||||
|
@ -415,15 +417,21 @@ private void nudQscale_ValueChanged(object sender, EventArgs e)
|
|||
UpdateUI();
|
||||
}
|
||||
|
||||
private void nudNVENCBitrate_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
Options.FFmpeg.NVENC_Bitrate = (int)nudNVENCBitrate.Value;
|
||||
UpdateUI();
|
||||
}
|
||||
|
||||
private void cbNVENCPreset_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
Options.FFmpeg.NVENC_Preset = (FFmpegNVENCPreset)cbNVENCPreset.SelectedIndex;
|
||||
UpdateUI();
|
||||
}
|
||||
|
||||
private void nudNVENCBitrate_ValueChanged(object sender, EventArgs e)
|
||||
private void cbNVENCTune_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
Options.FFmpeg.NVENC_Bitrate = (int)nudNVENCBitrate.Value;
|
||||
Options.FFmpeg.NVENC_Tune = (FFmpegNVENCTune)cbNVENCTune.SelectedIndex;
|
||||
UpdateUI();
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -47,7 +47,8 @@ public class FFmpegOptions
|
|||
public int x264_Bitrate { get; set; } = 3000; // kbit/s
|
||||
public int VPx_Bitrate { get; set; } = 3000; // kbit/s
|
||||
public int XviD_QScale { get; set; } = 10;
|
||||
public FFmpegNVENCPreset NVENC_Preset { get; set; } = FFmpegNVENCPreset.llhp;
|
||||
public FFmpegNVENCPreset NVENC_Preset { get; set; } = FFmpegNVENCPreset.p4;
|
||||
public FFmpegNVENCTune NVENC_Tune { get; set; } = FFmpegNVENCTune.ll;
|
||||
public int NVENC_Bitrate { get; set; } = 3000; // kbit/s
|
||||
public FFmpegPaletteGenStatsMode GIFStatsMode { get; set; } = FFmpegPaletteGenStatsMode.full;
|
||||
public FFmpegPaletteUseDither GIFDither { get; set; } = FFmpegPaletteUseDither.sierra2_4a;
|
||||
|
|
|
@ -267,6 +267,7 @@ public string GetFFmpegArgs(bool isCustom = false)
|
|||
case FFmpegVideoCodec.h264_nvenc: // https://trac.ffmpeg.org/wiki/HWAccelIntro#NVENC
|
||||
case FFmpegVideoCodec.hevc_nvenc:
|
||||
args.Append($"-preset {FFmpeg.NVENC_Preset} ");
|
||||
args.Append($"-tune {FFmpeg.NVENC_Tune} ");
|
||||
args.Append($"-b:v {FFmpeg.NVENC_Bitrate}k ");
|
||||
args.Append("-movflags +faststart "); // This will move some information to the beginning of your file and allow the video to begin playing before it is completely downloaded by the viewer
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue