From 3ad7d6ed84019b1612a4df34cdfc14ad5a674306 Mon Sep 17 00:00:00 2001 From: Scratch Date: Mon, 21 Oct 2019 23:51:32 +1100 Subject: [PATCH 1/2] Support Opus in FFMPEG Supports webm/mp4 files --- ShareX.ScreenCaptureLib/Enums.cs | 2 + .../Forms/FFmpegOptionsForm.Designer.cs | 156 ++-- .../Forms/FFmpegOptionsForm.cs | 10 +- .../Forms/FFmpegOptionsForm.resx | 761 ++++++++++-------- .../Screencast/FFmpegOptions.cs | 3 + .../Screencast/ScreencastOptions.cs | 3 + 6 files changed, 538 insertions(+), 397 deletions(-) diff --git a/ShareX.ScreenCaptureLib/Enums.cs b/ShareX.ScreenCaptureLib/Enums.cs index c948e7969..8ae4e80a7 100644 --- a/ShareX.ScreenCaptureLib/Enums.cs +++ b/ShareX.ScreenCaptureLib/Enums.cs @@ -211,6 +211,8 @@ public enum FFmpegAudioCodec { [Description("AAC")] libvoaacenc, + [Description("Opus")] + libopus, [Description("Vorbis")] libvorbis, [Description("MP3")] diff --git a/ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.Designer.cs b/ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.Designer.cs index 66d5b9f51..b9d0b2cdf 100644 --- a/ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.Designer.cs +++ b/ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.Designer.cs @@ -42,6 +42,7 @@ private void InitializeComponent() this.cbGIFDither = new System.Windows.Forms.ComboBox(); this.pbAudioCodecWarning = new System.Windows.Forms.PictureBox(); this.pbx264PresetWarning = new System.Windows.Forms.PictureBox(); + this.tbOpusBitrate = new System.Windows.Forms.TrackBar(); this.lblCodec = new System.Windows.Forms.Label(); this.cboVideoCodec = new System.Windows.Forms.ComboBox(); this.lblx264Preset = new System.Windows.Forms.Label(); @@ -76,6 +77,11 @@ private void InitializeComponent() this.lblAMFQuality = new System.Windows.Forms.Label(); this.cbAMFUsage = new System.Windows.Forms.ComboBox(); this.lblAMFUsage = new System.Windows.Forms.Label(); + this.tbQSV = new System.Windows.Forms.TabPage(); + this.cbQSVPreset = new System.Windows.Forms.ComboBox(); + this.lblQSVPreset = new System.Windows.Forms.Label(); + this.nudQSVBitrate = new System.Windows.Forms.NumericUpDown(); + this.lblQSVBitrate = new System.Windows.Forms.Label(); this.btnTest = new System.Windows.Forms.Button(); this.btnCopyPreview = new System.Windows.Forms.Button(); this.tcFFmpegAudioCodecs = new System.Windows.Forms.TabControl(); @@ -85,6 +91,8 @@ private void InitializeComponent() this.lblVorbisQuality = new System.Windows.Forms.Label(); this.tpMP3 = new System.Windows.Forms.TabPage(); this.lblMP3Quality = new System.Windows.Forms.Label(); + this.tpOpus = new System.Windows.Forms.TabPage(); + this.lblOpusQuality = new System.Windows.Forms.Label(); this.cboVideoSource = new System.Windows.Forms.ComboBox(); this.lblVideoSource = new System.Windows.Forms.Label(); this.cboAudioSource = new System.Windows.Forms.ComboBox(); @@ -98,11 +106,6 @@ private void InitializeComponent() this.btnRefreshSources = new System.Windows.Forms.Button(); this.gbCodecs = new System.Windows.Forms.GroupBox(); this.eiFFmpeg = new ShareX.HelpersLib.ExportImportControl(); - this.tbQSV = new System.Windows.Forms.TabPage(); - this.cbQSVPreset = new System.Windows.Forms.ComboBox(); - this.lblQSVPreset = new System.Windows.Forms.Label(); - this.nudQSVBitrate = new System.Windows.Forms.NumericUpDown(); - this.lblQSVBitrate = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.nudx264CRF)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudXvidQscale)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tbVorbis_qscale)).BeginInit(); @@ -110,6 +113,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.tbAACBitrate)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pbAudioCodecWarning)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pbx264PresetWarning)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.tbOpusBitrate)).BeginInit(); this.gbFFmpegExe.SuspendLayout(); this.gbCommandLinePreview.SuspendLayout(); this.gbCommandLineArgs.SuspendLayout(); @@ -122,14 +126,15 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.nudNVENCBitrate)).BeginInit(); this.tpGIF.SuspendLayout(); this.tbAMF.SuspendLayout(); + this.tbQSV.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nudQSVBitrate)).BeginInit(); this.tcFFmpegAudioCodecs.SuspendLayout(); this.tpAAC.SuspendLayout(); this.tpVorbis.SuspendLayout(); this.tpMP3.SuspendLayout(); + this.tpOpus.SuspendLayout(); this.gbSource.SuspendLayout(); this.gbCodecs.SuspendLayout(); - this.tbQSV.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.nudQSVBitrate)).BeginInit(); this.SuspendLayout(); // // lblx264CRF @@ -266,6 +271,19 @@ private void InitializeComponent() this.pbx264PresetWarning.TabStop = false; this.ttHelpTip.SetToolTip(this.pbx264PresetWarning, resources.GetString("pbx264PresetWarning.ToolTip")); // + // tbOpusBitrate + // + this.tbOpusBitrate.BackColor = System.Drawing.SystemColors.Window; + resources.ApplyResources(this.tbOpusBitrate, "tbOpusBitrate"); + this.tbOpusBitrate.LargeChange = 1; + this.tbOpusBitrate.Maximum = 16; + this.tbOpusBitrate.Minimum = 1; + this.tbOpusBitrate.Name = "tbOpusBitrate"; + this.tbOpusBitrate.TickStyle = System.Windows.Forms.TickStyle.Both; + this.ttHelpTip.SetToolTip(this.tbOpusBitrate, resources.GetString("tbOpusBitrate.ToolTip")); + this.tbOpusBitrate.Value = 4; + this.tbOpusBitrate.ValueChanged += new System.EventHandler(this.tbOpusBirate_ValueChanged); + // // lblCodec // resources.ApplyResources(this.lblCodec, "lblCodec"); @@ -544,6 +562,55 @@ private void InitializeComponent() resources.ApplyResources(this.lblAMFUsage, "lblAMFUsage"); this.lblAMFUsage.Name = "lblAMFUsage"; // + // tbQSV + // + this.tbQSV.Controls.Add(this.cbQSVPreset); + this.tbQSV.Controls.Add(this.lblQSVPreset); + this.tbQSV.Controls.Add(this.nudQSVBitrate); + this.tbQSV.Controls.Add(this.lblQSVBitrate); + resources.ApplyResources(this.tbQSV, "tbQSV"); + this.tbQSV.Name = "tbQSV"; + this.tbQSV.UseVisualStyleBackColor = true; + // + // cbQSVPreset + // + this.cbQSVPreset.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbQSVPreset.FormattingEnabled = true; + resources.ApplyResources(this.cbQSVPreset, "cbQSVPreset"); + this.cbQSVPreset.Name = "cbQSVPreset"; + this.cbQSVPreset.SelectedIndexChanged += new System.EventHandler(this.cbQSVPreset_SelectedIndexChanged); + // + // lblQSVPreset + // + resources.ApplyResources(this.lblQSVPreset, "lblQSVPreset"); + this.lblQSVPreset.Name = "lblQSVPreset"; + // + // nudQSVBitrate + // + resources.ApplyResources(this.nudQSVBitrate, "nudQSVBitrate"); + this.nudQSVBitrate.Maximum = new decimal(new int[] { + 50000, + 0, + 0, + 0}); + this.nudQSVBitrate.Minimum = new decimal(new int[] { + 100, + 0, + 0, + 0}); + this.nudQSVBitrate.Name = "nudQSVBitrate"; + this.nudQSVBitrate.Value = new decimal(new int[] { + 3000, + 0, + 0, + 0}); + this.nudQSVBitrate.ValueChanged += new System.EventHandler(this.nudQSVBitrate_ValueChanged); + // + // lblQSVBitrate + // + resources.ApplyResources(this.lblQSVBitrate, "lblQSVBitrate"); + this.lblQSVBitrate.Name = "lblQSVBitrate"; + // // btnTest // resources.ApplyResources(this.btnTest, "btnTest"); @@ -561,6 +628,7 @@ private void InitializeComponent() // tcFFmpegAudioCodecs // this.tcFFmpegAudioCodecs.Controls.Add(this.tpAAC); + this.tcFFmpegAudioCodecs.Controls.Add(this.tpOpus); this.tcFFmpegAudioCodecs.Controls.Add(this.tpVorbis); this.tcFFmpegAudioCodecs.Controls.Add(this.tpMP3); resources.ApplyResources(this.tcFFmpegAudioCodecs, "tcFFmpegAudioCodecs"); @@ -606,6 +674,19 @@ private void InitializeComponent() resources.ApplyResources(this.lblMP3Quality, "lblMP3Quality"); this.lblMP3Quality.Name = "lblMP3Quality"; // + // tpOpus + // + this.tpOpus.Controls.Add(this.tbOpusBitrate); + this.tpOpus.Controls.Add(this.lblOpusQuality); + resources.ApplyResources(this.tpOpus, "tpOpus"); + this.tpOpus.Name = "tpOpus"; + this.tpOpus.UseVisualStyleBackColor = true; + // + // lblOpusQuality + // + resources.ApplyResources(this.lblOpusQuality, "lblOpusQuality"); + this.lblOpusQuality.Name = "lblOpusQuality"; + // // cboVideoSource // this.cboVideoSource.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; @@ -707,55 +788,6 @@ private void InitializeComponent() this.eiFFmpeg.ExportRequested += new ShareX.HelpersLib.ExportImportControl.ExportEventHandler(this.eiFFmpeg_ExportRequested); this.eiFFmpeg.ImportRequested += new ShareX.HelpersLib.ExportImportControl.ImportEventHandler(this.eiFFmpeg_ImportRequested); // - // tbQSV - // - this.tbQSV.Controls.Add(this.cbQSVPreset); - this.tbQSV.Controls.Add(this.lblQSVPreset); - this.tbQSV.Controls.Add(this.nudQSVBitrate); - this.tbQSV.Controls.Add(this.lblQSVBitrate); - resources.ApplyResources(this.tbQSV, "tbQSV"); - this.tbQSV.Name = "tbQSV"; - this.tbQSV.UseVisualStyleBackColor = true; - // - // cbQSVPreset - // - this.cbQSVPreset.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbQSVPreset.FormattingEnabled = true; - resources.ApplyResources(this.cbQSVPreset, "cbQSVPreset"); - this.cbQSVPreset.Name = "cbQSVPreset"; - this.cbQSVPreset.SelectedIndexChanged += new System.EventHandler(this.cbQSVPreset_SelectedIndexChanged); - // - // lblQSVPreset - // - resources.ApplyResources(this.lblQSVPreset, "lblQSVPreset"); - this.lblQSVPreset.Name = "lblQSVPreset"; - // - // nudQSVBitrate - // - resources.ApplyResources(this.nudQSVBitrate, "nudQSVBitrate"); - this.nudQSVBitrate.Maximum = new decimal(new int[] { - 50000, - 0, - 0, - 0}); - this.nudQSVBitrate.Minimum = new decimal(new int[] { - 100, - 0, - 0, - 0}); - this.nudQSVBitrate.Name = "nudQSVBitrate"; - this.nudQSVBitrate.Value = new decimal(new int[] { - 3000, - 0, - 0, - 0}); - this.nudQSVBitrate.ValueChanged += new System.EventHandler(this.nudQSVBitrate_ValueChanged); - // - // lblQSVBitrate - // - resources.ApplyResources(this.lblQSVBitrate, "lblQSVBitrate"); - this.lblQSVBitrate.Name = "lblQSVBitrate"; - // // FFmpegOptionsForm // resources.ApplyResources(this, "$this"); @@ -783,6 +815,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.tbAACBitrate)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pbAudioCodecWarning)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pbx264PresetWarning)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.tbOpusBitrate)).EndInit(); this.gbFFmpegExe.ResumeLayout(false); this.gbFFmpegExe.PerformLayout(); this.gbCommandLinePreview.ResumeLayout(false); @@ -804,6 +837,9 @@ private void InitializeComponent() this.tpGIF.PerformLayout(); this.tbAMF.ResumeLayout(false); this.tbAMF.PerformLayout(); + this.tbQSV.ResumeLayout(false); + this.tbQSV.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nudQSVBitrate)).EndInit(); this.tcFFmpegAudioCodecs.ResumeLayout(false); this.tpAAC.ResumeLayout(false); this.tpAAC.PerformLayout(); @@ -811,13 +847,12 @@ private void InitializeComponent() this.tpVorbis.PerformLayout(); this.tpMP3.ResumeLayout(false); this.tpMP3.PerformLayout(); + this.tpOpus.ResumeLayout(false); + this.tpOpus.PerformLayout(); this.gbSource.ResumeLayout(false); this.gbSource.PerformLayout(); this.gbCodecs.ResumeLayout(false); this.gbCodecs.PerformLayout(); - this.tbQSV.ResumeLayout(false); - this.tbQSV.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.nudQSVBitrate)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -898,5 +933,8 @@ private void InitializeComponent() private System.Windows.Forms.Label lblQSVPreset; private System.Windows.Forms.NumericUpDown nudQSVBitrate; private System.Windows.Forms.Label lblQSVBitrate; + private System.Windows.Forms.TabPage tpOpus; + private System.Windows.Forms.TrackBar tbOpusBitrate; + private System.Windows.Forms.Label lblOpusQuality; } } \ No newline at end of file diff --git a/ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.cs b/ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.cs index b5af9baba..63c1a3277 100644 --- a/ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.cs +++ b/ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.cs @@ -194,6 +194,7 @@ private void UpdateUI() lblAACQuality.Text = string.Format(Resources.FFmpegOptionsForm_UpdateUI_Bitrate___0_k, Options.FFmpeg.AAC_bitrate); lblVorbisQuality.Text = Resources.FFmpegOptionsForm_UpdateUI_Quality_ + " " + Options.FFmpeg.Vorbis_qscale; lblMP3Quality.Text = Resources.FFmpegOptionsForm_UpdateUI_Quality_ + " " + Options.FFmpeg.MP3_qscale; + lblOpusQuality.Text = string.Format(Resources.FFmpegOptionsForm_UpdateUI_Bitrate___0_k, Options.FFmpeg.Opus_bitrate); bool isValidAudioCodec = true; FFmpegVideoCodec videoCodec = (FFmpegVideoCodec)cboVideoCodec.SelectedIndex; @@ -202,7 +203,7 @@ private void UpdateUI() { FFmpegAudioCodec audioCodec = (FFmpegAudioCodec)cboAudioCodec.SelectedIndex; - if (audioCodec != FFmpegAudioCodec.libvorbis) + if (audioCodec != FFmpegAudioCodec.libvorbis && audioCodec != FFmpegAudioCodec.libopus) { isValidAudioCodec = false; } @@ -470,6 +471,12 @@ private void tbAACBitrate_ValueChanged(object sender, EventArgs e) UpdateUI(); } + private void tbOpusBirate_ValueChanged(object sender, EventArgs e) + { + Options.FFmpeg.Opus_bitrate = tbOpusBitrate.Value * 32; + UpdateUI(); + } + private void tbVorbis_qscale_ValueChanged(object sender, EventArgs e) { Options.FFmpeg.Vorbis_qscale = tbVorbis_qscale.Value; @@ -586,5 +593,6 @@ private async void eiFFmpeg_ImportRequested(object obj) await SettingsLoad(); } } + } } \ No newline at end of file diff --git a/ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.resx b/ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.resx index 7baf184a7..6c8299992 100644 --- a/ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.resx +++ b/ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.resx @@ -146,9 +146,6 @@ 2 - - 17, 17 - 144, 12 @@ -162,6 +159,9 @@ Center + + 17, 17 + Constant Rate Factor (CRF): The value can be between 0-51, where 0 is lossless, 30 is default, and 51 is the worst possible. A higher value means bad quality, but a low file size. @@ -424,6 +424,36 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< 0 + + Right + + + NoControl + + + 104, 3 + + + 197, 64 + + + 3 + + + Default is 128k. + + + tbOpusBitrate + + + System.Windows.Forms.TrackBar, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpOpus + + + 0 + True @@ -526,6 +556,18 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< 1 + + 552, 22 + + + 88, 24 + + + 2 + + + Download + btnDownload @@ -538,6 +580,18 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< 0 + + 512, 22 + + + 32, 24 + + + 1 + + + ... + btnFFmpegBrowse @@ -550,6 +604,15 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< 1 + + 8, 24 + + + 496, 20 + + + 0 + txtFFmpegPath @@ -586,39 +649,6 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< 7 - - 552, 22 - - - 88, 24 - - - 2 - - - Download - - - 512, 22 - - - 32, 24 - - - 1 - - - ... - - - 8, 24 - - - 496, 20 - - - 0 - True @@ -646,6 +676,21 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< 0 + + True + + + 376, 0 + + + 136, 17 + + + 1 + + + Use custom commands + cbCustomCommands @@ -658,6 +703,27 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< 0 + + Fill + + + Microsoft Sans Serif, 9.75pt + + + 8, 21 + + + True + + + Vertical + + + 632, 67 + + + 0 + txtCommandLinePreview @@ -697,40 +763,16 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< 6 - - True + + Top, Left, Right - - 376, 0 + + 8, 24 - - 136, 17 + + 632, 20 - - 1 - - - Use custom commands - - - Fill - - - Microsoft Sans Serif, 9.75pt - - - 8, 21 - - - True - - - Vertical - - - 632, 67 - - + 0 @@ -769,18 +811,6 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< 8 - - Top, Left, Right - - - 8, 24 - - - 632, 20 - - - 0 - 4, 22 @@ -808,6 +838,24 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< 0 + + True + + + NoControl + + + 220, 16 + + + 34, 13 + + + 2 + + + kbit/s + lblVP8BitrateK @@ -820,6 +868,18 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< 0 + + 144, 12 + + + 72, 20 + + + 1 + + + Center + nudVP8Bitrate @@ -832,6 +892,21 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< 1 + + True + + + 16, 16 + + + 80, 13 + + + 0 + + + Variable bitrate: + lblVP8Bitrate @@ -892,6 +967,15 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< 2 + + 96, 12 + + + 192, 21 + + + 3 + cbNVENCPreset @@ -904,6 +988,21 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< 0 + + True + + + 16, 16 + + + 40, 13 + + + 2 + + + Preset: + lblNVENCPreset @@ -916,6 +1015,18 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< 1 + + 96, 36 + + + 88, 20 + + + 1 + + + Center + nudNVENCBitrate @@ -928,6 +1039,21 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< 2 + + True + + + 16, 40 + + + 40, 13 + + + 0 + + + Bitrate: + lblNVENCBitrate @@ -967,6 +1093,24 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< 3 + + True + + + NoControl + + + 16, 40 + + + 81, 13 + + + 2 + + + Dithering mode: + lblGIFDither @@ -979,6 +1123,21 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< 1 + + True + + + 16, 16 + + + 72, 13 + + + 0 + + + Palette mode: + lblGIFStatsMode @@ -1300,135 +1459,6 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< 6 - - True - - - NoControl - - - 220, 16 - - - 34, 13 - - - 2 - - - kbit/s - - - 144, 12 - - - 72, 20 - - - 1 - - - Center - - - True - - - 16, 16 - - - 80, 13 - - - 0 - - - Variable bitrate: - - - 96, 12 - - - 192, 21 - - - 3 - - - True - - - 16, 16 - - - 40, 13 - - - 2 - - - Preset: - - - 96, 36 - - - 88, 20 - - - 1 - - - Center - - - True - - - 16, 40 - - - 40, 13 - - - 0 - - - Bitrate: - - - True - - - NoControl - - - 16, 40 - - - 81, 13 - - - 2 - - - Dithering mode: - - - True - - - 16, 16 - - - 72, 13 - - - 0 - - - Palette mode: - 176, 404 @@ -1477,62 +1507,20 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< 4 - - tpAAC + + True - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 16, 16 - - tcFFmpegAudioCodecs + + 40, 13 - + 0 - - tpVorbis - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tcFFmpegAudioCodecs - - - 1 - - - tpMP3 - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tcFFmpegAudioCodecs - - - 2 - - - 328, 56 - - - 312, 96 - - - 4 - - - tcFFmpegAudioCodecs - - - System.Windows.Forms.TabControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gbCodecs - - - 5 + + Bitrate: lblAACQuality @@ -1561,20 +1549,32 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< AAC - - True + + tpAAC - - 16, 16 + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 40, 13 + + tcFFmpegAudioCodecs - + 0 - - Bitrate: + + True + + + 16, 16 + + + 42, 13 + + + 0 + + + Quality: lblVorbisQuality @@ -1603,19 +1603,31 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< Vorbis - + + tpVorbis + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tcFFmpegAudioCodecs + + + 1 + + True - + 16, 16 - + 42, 13 - + 0 - + Quality: @@ -1645,20 +1657,95 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< MP3 - + + tpMP3 + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tcFFmpegAudioCodecs + + + 2 + + True - + + NoControl + + 16, 16 - - 42, 13 + + 40, 13 - - 0 + + 2 - - Quality: + + Bitrate: + + + lblOpusQuality + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpOpus + + + 1 + + + 4, 22 + + + 3, 3, 3, 3 + + + 304, 70 + + + 4 + + + Opus + + + tpOpus + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tcFFmpegAudioCodecs + + + 3 + + + 328, 56 + + + 312, 96 + + + 4 + + + tcFFmpegAudioCodecs + + + System.Windows.Forms.TabControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gbCodecs + + + 5 184, 25 @@ -1804,6 +1891,18 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< 2 + + 168, 56 + + + 24, 23 + + + 7 + + + ? + btnHelperDevicesHelp @@ -1816,6 +1915,21 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< 0 + + True + + + 200, 61 + + + 396, 13 + + + 6 + + + Installs "screen-capture-recorder" and "virtual-audio-capturer" video/audio source. + lblHelperDevices @@ -1828,6 +1942,18 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< 1 + + 8, 56 + + + 152, 23 + + + 5 + + + Install recorder devices + btnInstallHelperDevices @@ -1840,6 +1966,18 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< 2 + + 8, 24 + + + 88, 23 + + + 0 + + + Refresh + btnRefreshSources @@ -1876,57 +2014,6 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< 3 - - 168, 56 - - - 24, 23 - - - 7 - - - ? - - - True - - - 200, 61 - - - 396, 13 - - - 6 - - - Installs "screen-capture-recorder" and "virtual-audio-capturer" video/audio source. - - - 8, 56 - - - 152, 23 - - - 5 - - - Install recorder devices - - - 8, 24 - - - 88, 23 - - - 0 - - - Refresh - 8, 168 @@ -1964,7 +2051,7 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< eiFFmpeg - ShareX.HelpersLib.ExportImportControl, ShareX.HelpersLib, Version=12.4.2.0, Culture=neutral, PublicKeyToken=null + ShareX.HelpersLib.ExportImportControl, ShareX.HelpersLib, Version=13.0.2.0, Culture=neutral, PublicKeyToken=null $this @@ -1972,12 +2059,12 @@ Otherwise it can't keep up with recording and a lot of frame drops will happen.< 1 - + True - - + + 60 - + 6, 13 diff --git a/ShareX.ScreenCaptureLib/Screencast/FFmpegOptions.cs b/ShareX.ScreenCaptureLib/Screencast/FFmpegOptions.cs index 62550b2ad..c468cd799 100644 --- a/ShareX.ScreenCaptureLib/Screencast/FFmpegOptions.cs +++ b/ShareX.ScreenCaptureLib/Screencast/FFmpegOptions.cs @@ -58,6 +58,7 @@ public class FFmpegOptions // Audio public int AAC_bitrate { get; set; } = 128; // kbit/s + public int Opus_bitrate { get; set; } = 128; //kbit/s public int Vorbis_qscale { get; set; } = 3; public int MP3_qscale { get; set; } = 4; @@ -123,6 +124,8 @@ public string Extension { case FFmpegAudioCodec.libvoaacenc: return "m4a"; + case FFmpegAudioCodec.libopus: + return "opus"; case FFmpegAudioCodec.libvorbis: return "ogg"; case FFmpegAudioCodec.libmp3lame: diff --git a/ShareX.ScreenCaptureLib/Screencast/ScreencastOptions.cs b/ShareX.ScreenCaptureLib/Screencast/ScreencastOptions.cs index 02144f91b..b3d474bd0 100644 --- a/ShareX.ScreenCaptureLib/Screencast/ScreencastOptions.cs +++ b/ShareX.ScreenCaptureLib/Screencast/ScreencastOptions.cs @@ -230,6 +230,9 @@ public string GetFFmpegArgs(bool isCustom = false) case FFmpegAudioCodec.libvoaacenc: // http://trac.ffmpeg.org/wiki/Encode/AAC args.AppendFormat("-c:a aac -strict -2 -ac 2 -b:a {0}k ", FFmpeg.AAC_bitrate); // -ac 2 required otherwise failing with 7.1 break; + case FFmpegAudioCodec.libopus: // https://www.ffmpeg.org/ffmpeg-codecs.html#libopus-1 + args.AppendFormat("-c:a libopus -b:a {0}k ", FFmpeg.Opus_bitrate); + break; case FFmpegAudioCodec.libvorbis: // http://trac.ffmpeg.org/wiki/TheoraVorbisEncodingGuide args.AppendFormat("-c:a libvorbis -qscale:a {0} ", FFmpeg.Vorbis_qscale); break; From 6915a279c1bf64795e0b625fdb605f751a03c33a Mon Sep 17 00:00:00 2001 From: Scratch Date: Tue, 22 Oct 2019 00:30:43 +1100 Subject: [PATCH 2/2] Fix AudioCodec Combobox --- ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.cs b/ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.cs index 63c1a3277..e2d8ac683 100644 --- a/ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.cs +++ b/ShareX.ScreenCaptureLib/Forms/FFmpegOptionsForm.cs @@ -381,12 +381,15 @@ private void cboAudioCodec_SelectedIndexChanged(object sender, EventArgs e) case FFmpegAudioCodec.libvoaacenc: tcFFmpegAudioCodecs.SelectedIndex = 0; break; - case FFmpegAudioCodec.libvorbis: + case FFmpegAudioCodec.libopus: tcFFmpegAudioCodecs.SelectedIndex = 1; break; - case FFmpegAudioCodec.libmp3lame: + case FFmpegAudioCodec.libvorbis: tcFFmpegAudioCodecs.SelectedIndex = 2; break; + case FFmpegAudioCodec.libmp3lame: + tcFFmpegAudioCodecs.SelectedIndex = 3; + break; } } @@ -593,6 +596,5 @@ private async void eiFFmpeg_ImportRequested(object obj) await SettingsLoad(); } } - } } \ No newline at end of file