diff --git a/ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.Designer.cs b/ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.Designer.cs index d0d9ed2dc..4970c492c 100644 --- a/ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.Designer.cs +++ b/ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.Designer.cs @@ -106,6 +106,9 @@ 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.lblAMFBitrateK = new System.Windows.Forms.Label(); + this.nudAMFBitrate = new System.Windows.Forms.NumericUpDown(); + this.lblAMFBitrate = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.nudx264CRF)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudXvidQscale)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tbVorbis_qscale)).BeginInit(); @@ -131,6 +134,7 @@ private void InitializeComponent() this.tpOpus.SuspendLayout(); this.tpVorbis.SuspendLayout(); this.tpMP3.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nudAMFBitrate)).BeginInit(); this.SuspendLayout(); // // lblx264CRF @@ -529,6 +533,9 @@ private void InitializeComponent() // // tbAMF // + this.tbAMF.Controls.Add(this.lblAMFBitrateK); + this.tbAMF.Controls.Add(this.nudAMFBitrate); + this.tbAMF.Controls.Add(this.lblAMFBitrate); this.tbAMF.Controls.Add(this.cbAMFQuality); this.tbAMF.Controls.Add(this.lblAMFQuality); this.tbAMF.Controls.Add(this.cbAMFUsage); @@ -785,6 +792,37 @@ private void InitializeComponent() resources.ApplyResources(this.lblAudioEncoder, "lblAudioEncoder"); this.lblAudioEncoder.Name = "lblAudioEncoder"; // + // lblAMFBitrateK + // + resources.ApplyResources(this.lblAMFBitrateK, "lblAMFBitrateK"); + this.lblAMFBitrateK.Name = "lblAMFBitrateK"; + // + // nudAMFBitrate + // + resources.ApplyResources(this.nudAMFBitrate, "nudAMFBitrate"); + this.nudAMFBitrate.Maximum = new decimal(new int[] { + 100000, + 0, + 0, + 0}); + this.nudAMFBitrate.Minimum = new decimal(new int[] { + 100, + 0, + 0, + 0}); + this.nudAMFBitrate.Name = "nudAMFBitrate"; + this.nudAMFBitrate.Value = new decimal(new int[] { + 3000, + 0, + 0, + 0}); + this.nudAMFBitrate.ValueChanged += new System.EventHandler(this.nudAMFBitrate_ValueChanged); + // + // lblAMFBitrate + // + resources.ApplyResources(this.lblAMFBitrate, "lblAMFBitrate"); + this.lblAMFBitrate.Name = "lblAMFBitrate"; + // // FFmpegOptionsForm // resources.ApplyResources(this, "$this"); @@ -856,6 +894,7 @@ private void InitializeComponent() this.tpVorbis.PerformLayout(); this.tpMP3.ResumeLayout(false); this.tpMP3.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nudAMFBitrate)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -939,5 +978,8 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox cbUseCustomFFmpegPath; private System.Windows.Forms.Label lblVideoEncoder; private System.Windows.Forms.Label lblAudioEncoder; + private System.Windows.Forms.Label lblAMFBitrateK; + private System.Windows.Forms.NumericUpDown nudAMFBitrate; + private System.Windows.Forms.Label lblAMFBitrate; } } \ No newline at end of file diff --git a/ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.cs b/ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.cs index 3842f8057..dba345190 100644 --- a/ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.cs +++ b/ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.cs @@ -106,10 +106,11 @@ private async Task SettingsLoad() // AMF cbAMFUsage.SelectedIndex = (int)Options.FFmpeg.AMF_Usage; cbAMFQuality.SelectedIndex = (int)Options.FFmpeg.AMF_Quality; + nudAMFBitrate.SetValue(Options.FFmpeg.AMF_Bitrate); // QuickSync - nudQSVBitrate.SetValue(Options.FFmpeg.QSV_Bitrate); cbQSVPreset.SelectedIndex = (int)Options.FFmpeg.QSV_Preset; + nudQSVBitrate.SetValue(Options.FFmpeg.QSV_Bitrate); // AAC tbAACBitrate.Value = Options.FFmpeg.AAC_Bitrate / 32; @@ -471,6 +472,12 @@ private void cbAMFQuality_SelectedIndexChanged(object sender, EventArgs e) UpdateUI(); } + private void nudAMFBitrate_ValueChanged(object sender, EventArgs e) + { + Options.FFmpeg.AMF_Bitrate = (int)nudAMFBitrate.Value; + UpdateUI(); + } + private void cbQSVPreset_SelectedIndexChanged(object sender, EventArgs e) { Options.FFmpeg.QSV_Preset = (FFmpegQSVPreset)cbQSVPreset.SelectedIndex; diff --git a/ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.resx b/ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.resx index 0b8712e34..abf84bef7 100644 --- a/ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.resx +++ b/ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.resx @@ -940,6 +940,99 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< 4 + + True + + + NoControl + + + 157, 56 + + + 34, 13 + + + 10 + + + kbit/s + + + lblAMFBitrateK + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tbAMF + + + 0 + + + 80, 52 + + + 72, 20 + + + 9 + + + Center + + + nudAMFBitrate + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tbAMF + + + 1 + + + True + + + NoControl + + + 0, 56 + + + 40, 13 + + + 8 + + + Bitrate: + + + lblAMFBitrate + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tbAMF + + + 2 + + + 80, 28 + + + 232, 21 + + + 7 + cbAMFQuality @@ -950,7 +1043,25 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< tbAMF - 0 + 3 + + + True + + + NoControl + + + 0, 32 + + + 42, 13 + + + 6 + + + Quality: lblAMFQuality @@ -962,7 +1073,16 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< tbAMF - 1 + 4 + + + 80, 4 + + + 232, 21 + + + 5 cbAMFUsage @@ -974,7 +1094,25 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< tbAMF - 2 + 5 + + + True + + + NoControl + + + 0, 8 + + + 41, 13 + + + 4 + + + Usage: lblAMFUsage @@ -986,7 +1124,7 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< tbAMF - 3 + 6 4, 40 @@ -1465,108 +1603,6 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< 4 - - 80, 28 - - - 232, 21 - - - 7 - - - cbAMFQuality - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tbAMF - - - 0 - - - True - - - NoControl - - - 0, 32 - - - 42, 13 - - - 6 - - - Quality: - - - lblAMFQuality - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tbAMF - - - 1 - - - 80, 4 - - - 232, 21 - - - 5 - - - cbAMFUsage - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tbAMF - - - 2 - - - True - - - NoControl - - - 0, 8 - - - 41, 13 - - - 4 - - - Usage: - - - lblAMFUsage - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tbAMF - - - 3 - True diff --git a/ShareX.ScreenCaptureLib/ScreenRecording/FFmpegOptions.cs b/ShareX.ScreenCaptureLib/ScreenRecording/FFmpegOptions.cs index 7823106c1..80ebd14ba 100644 --- a/ShareX.ScreenCaptureLib/ScreenRecording/FFmpegOptions.cs +++ b/ShareX.ScreenCaptureLib/ScreenRecording/FFmpegOptions.cs @@ -52,8 +52,9 @@ public class FFmpegOptions public FFmpegPaletteGenStatsMode GIFStatsMode { get; set; } = FFmpegPaletteGenStatsMode.full; public FFmpegPaletteUseDither GIFDither { get; set; } = FFmpegPaletteUseDither.sierra2_4a; public int GIFBayerScale { get; set; } = 2; - public FFmpegAMFUsage AMF_Usage { get; set; } = FFmpegAMFUsage.transcoding; + public FFmpegAMFUsage AMF_Usage { get; set; } = FFmpegAMFUsage.lowlatency; public FFmpegAMFQuality AMF_Quality { get; set; } = FFmpegAMFQuality.speed; + public int AMF_Bitrate { get; set; } = 3000; // kbit/s public FFmpegQSVPreset QSV_Preset { get; set; } = FFmpegQSVPreset.fast; public int QSV_Bitrate { get; set; } = 3000; // kbit/s diff --git a/ShareX.ScreenCaptureLib/ScreenRecording/ScreenRecordingOptions.cs b/ShareX.ScreenCaptureLib/ScreenRecording/ScreenRecordingOptions.cs index 059fef262..105fec11f 100644 --- a/ShareX.ScreenCaptureLib/ScreenRecording/ScreenRecordingOptions.cs +++ b/ShareX.ScreenCaptureLib/ScreenRecording/ScreenRecordingOptions.cs @@ -268,6 +268,7 @@ public string GetFFmpegArgs(bool isCustom = false) case FFmpegVideoCodec.hevc_amf: args.Append($"-usage {FFmpeg.AMF_Usage} "); args.Append($"-quality {FFmpeg.AMF_Quality} "); + args.Append($"-b:v {FFmpeg.AMF_Bitrate}k "); args.Append("-pix_fmt yuv420p "); break; case FFmpegVideoCodec.h264_qsv: // https://trac.ffmpeg.org/wiki/Hardware/QuickSync