From 63ab1b3fbe5fa0700d486957793510aef7d8dd6e Mon Sep 17 00:00:00 2001 From: Jaex Date: Wed, 14 May 2014 15:08:51 +0300 Subject: [PATCH] FFmpeg options form changes --- ScreenCaptureLib/Screencast/FFmpegOptions.cs | 4 +- .../Screencast/FFmpegOptionsForm.Designer.cs | 114 ++++++++++-------- .../Screencast/FFmpegOptionsForm.cs | 2 - .../Screencast/FFmpegOptionsForm.resx | 4 +- .../Screencast/ScreencastOptions.cs | 33 ++--- 5 files changed, 75 insertions(+), 82 deletions(-) diff --git a/ScreenCaptureLib/Screencast/FFmpegOptions.cs b/ScreenCaptureLib/Screencast/FFmpegOptions.cs index 84ef38d1d..55ece17da 100644 --- a/ScreenCaptureLib/Screencast/FFmpegOptions.cs +++ b/ScreenCaptureLib/Screencast/FFmpegOptions.cs @@ -78,10 +78,10 @@ public FFmpegOptions() // XviD XviD_qscale = 3; - // Vorbis + // Audio Vorbis_qscale = 3; MP3_qscale = 4; - AAC_bitrate = 64; + AAC_bitrate = 128; } public bool IsAudioSourceSelected() diff --git a/ScreenCaptureLib/Screencast/FFmpegOptionsForm.Designer.cs b/ScreenCaptureLib/Screencast/FFmpegOptionsForm.Designer.cs index 7bc215037..cfbcb0d22 100644 --- a/ScreenCaptureLib/Screencast/FFmpegOptionsForm.Designer.cs +++ b/ScreenCaptureLib/Screencast/FFmpegOptionsForm.Designer.cs @@ -65,6 +65,9 @@ private void InitializeComponent() this.tpMP3 = new System.Windows.Forms.TabPage(); this.tbMP3_qscale = new System.Windows.Forms.TrackBar(); this.lblMP3Quality = new System.Windows.Forms.Label(); + this.tpAAC = new System.Windows.Forms.TabPage(); + this.tbAACBitrate = new System.Windows.Forms.TrackBar(); + this.lblAACQuality = 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(); @@ -75,9 +78,6 @@ private void InitializeComponent() this.gbCodecs = new System.Windows.Forms.GroupBox(); this.gbContainer = new System.Windows.Forms.GroupBox(); this.btnRefreshSources = new System.Windows.Forms.Button(); - this.tpAAC = new System.Windows.Forms.TabPage(); - this.tbAACBitrate = new System.Windows.Forms.TrackBar(); - this.lblAACQuality = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.nudx264CRF)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudQscale)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudVPxCRF)).BeginInit(); @@ -93,11 +93,11 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.tbVorbis_qscale)).BeginInit(); this.tpMP3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.tbMP3_qscale)).BeginInit(); + this.tpAAC.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.tbAACBitrate)).BeginInit(); this.gbSource.SuspendLayout(); this.gbCodecs.SuspendLayout(); this.gbContainer.SuspendLayout(); - this.tpAAC.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.tbAACBitrate)).BeginInit(); this.SuspendLayout(); // // lblExt @@ -191,7 +191,7 @@ private void InitializeComponent() this.nudVPxCRF.TabIndex = 1; this.nudVPxCRF.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.tpFFmpeg.SetToolTip(this.nudVPxCRF, "CRF value can be from 4–63, and 10 is a good starting point. Lower values mean be" + - "tter quality. "); + "tter quality."); this.nudVPxCRF.Value = new decimal(new int[] { 12, 0, @@ -236,6 +236,7 @@ private void InitializeComponent() this.cbPreset.Name = "cbPreset"; this.cbPreset.Size = new System.Drawing.Size(121, 21); this.cbPreset.TabIndex = 3; + this.tpFFmpeg.SetToolTip(this.cbPreset, "Default is \"Medium\"."); this.cbPreset.SelectedIndexChanged += new System.EventHandler(this.cbPreset_SelectedIndexChanged); // // lblPreset @@ -456,18 +457,20 @@ private void InitializeComponent() this.tbVorbis_qscale.BackColor = System.Drawing.Color.White; this.tbVorbis_qscale.Dock = System.Windows.Forms.DockStyle.Right; this.tbVorbis_qscale.LargeChange = 1; - this.tbVorbis_qscale.Location = new System.Drawing.Point(64, 3); + this.tbVorbis_qscale.Location = new System.Drawing.Point(88, 3); this.tbVorbis_qscale.Name = "tbVorbis_qscale"; - this.tbVorbis_qscale.Size = new System.Drawing.Size(245, 40); + this.tbVorbis_qscale.Size = new System.Drawing.Size(221, 40); this.tbVorbis_qscale.TabIndex = 1; this.tbVorbis_qscale.TickStyle = System.Windows.Forms.TickStyle.Both; + this.tpFFmpeg.SetToolTip(this.tbVorbis_qscale, "Range is 0–10, where 10 is highest quality. 3–6 is a good range to try. Default i" + + "s 3."); this.tbVorbis_qscale.Value = 3; this.tbVorbis_qscale.Scroll += new System.EventHandler(this.tbVorbis_qscale_Scroll); // // lblVorbisQuality // this.lblVorbisQuality.AutoSize = true; - this.lblVorbisQuality.Location = new System.Drawing.Point(8, 16); + this.lblVorbisQuality.Location = new System.Drawing.Point(16, 16); this.lblVorbisQuality.Name = "lblVorbisQuality"; this.lblVorbisQuality.Size = new System.Drawing.Size(42, 13); this.lblVorbisQuality.TabIndex = 0; @@ -479,6 +482,7 @@ private void InitializeComponent() this.tpMP3.Controls.Add(this.lblMP3Quality); this.tpMP3.Location = new System.Drawing.Point(4, 22); this.tpMP3.Name = "tpMP3"; + this.tpMP3.Padding = new System.Windows.Forms.Padding(3); this.tpMP3.Size = new System.Drawing.Size(312, 46); this.tpMP3.TabIndex = 2; this.tpMP3.Text = "MP3"; @@ -489,24 +493,66 @@ private void InitializeComponent() this.tbMP3_qscale.BackColor = System.Drawing.Color.White; this.tbMP3_qscale.Dock = System.Windows.Forms.DockStyle.Right; this.tbMP3_qscale.LargeChange = 1; - this.tbMP3_qscale.Location = new System.Drawing.Point(56, 0); + this.tbMP3_qscale.Location = new System.Drawing.Point(88, 3); this.tbMP3_qscale.Maximum = 9; this.tbMP3_qscale.Name = "tbMP3_qscale"; - this.tbMP3_qscale.Size = new System.Drawing.Size(256, 46); + this.tbMP3_qscale.Size = new System.Drawing.Size(221, 40); this.tbMP3_qscale.TabIndex = 1; this.tbMP3_qscale.TickStyle = System.Windows.Forms.TickStyle.Both; + this.tpFFmpeg.SetToolTip(this.tbMP3_qscale, "Range is 0-9 where a lower value is a higher quality. 0-3 will normally produce t" + + "ransparent results, 4 (default) should be close to perceptual transparency, and " + + "6 produces an \"acceptable\" quality."); this.tbMP3_qscale.Value = 5; this.tbMP3_qscale.Scroll += new System.EventHandler(this.tbMP3_qscale_Scroll); // // lblMP3Quality // this.lblMP3Quality.AutoSize = true; - this.lblMP3Quality.Location = new System.Drawing.Point(8, 16); + this.lblMP3Quality.Location = new System.Drawing.Point(16, 16); this.lblMP3Quality.Name = "lblMP3Quality"; this.lblMP3Quality.Size = new System.Drawing.Size(42, 13); this.lblMP3Quality.TabIndex = 0; this.lblMP3Quality.Text = "Quality:"; // + // tpAAC + // + this.tpAAC.Controls.Add(this.tbAACBitrate); + this.tpAAC.Controls.Add(this.lblAACQuality); + this.tpAAC.Location = new System.Drawing.Point(4, 22); + this.tpAAC.Name = "tpAAC"; + this.tpAAC.Padding = new System.Windows.Forms.Padding(3); + this.tpAAC.Size = new System.Drawing.Size(312, 46); + this.tpAAC.TabIndex = 3; + this.tpAAC.Text = "AAC"; + this.tpAAC.UseVisualStyleBackColor = true; + // + // tbAACBitrate + // + this.tbAACBitrate.BackColor = System.Drawing.Color.White; + this.tbAACBitrate.Dock = System.Windows.Forms.DockStyle.Right; + this.tbAACBitrate.LargeChange = 32; + this.tbAACBitrate.Location = new System.Drawing.Point(88, 3); + this.tbAACBitrate.Maximum = 320; + this.tbAACBitrate.Minimum = 32; + this.tbAACBitrate.Name = "tbAACBitrate"; + this.tbAACBitrate.Size = new System.Drawing.Size(221, 40); + this.tbAACBitrate.SmallChange = 32; + this.tbAACBitrate.TabIndex = 1; + this.tbAACBitrate.TickFrequency = 32; + this.tbAACBitrate.TickStyle = System.Windows.Forms.TickStyle.Both; + this.tpFFmpeg.SetToolTip(this.tbAACBitrate, "Default is 128k."); + this.tbAACBitrate.Value = 64; + this.tbAACBitrate.Scroll += new System.EventHandler(this.tbAACBitrate_Scroll); + // + // lblAACQuality + // + this.lblAACQuality.AutoSize = true; + this.lblAACQuality.Location = new System.Drawing.Point(16, 16); + this.lblAACQuality.Name = "lblAACQuality"; + this.lblAACQuality.Size = new System.Drawing.Size(40, 13); + this.lblAACQuality.TabIndex = 0; + this.lblAACQuality.Text = "Bitrate:"; + // // cboVideoSource // this.cboVideoSource.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; @@ -611,44 +657,6 @@ private void InitializeComponent() this.btnRefreshSources.UseVisualStyleBackColor = true; this.btnRefreshSources.Click += new System.EventHandler(this.btnRefreshSources_Click); // - // tpAAC - // - this.tpAAC.Controls.Add(this.tbAACBitrate); - this.tpAAC.Controls.Add(this.lblAACQuality); - this.tpAAC.Location = new System.Drawing.Point(4, 22); - this.tpAAC.Name = "tpAAC"; - this.tpAAC.Padding = new System.Windows.Forms.Padding(3); - this.tpAAC.Size = new System.Drawing.Size(312, 46); - this.tpAAC.TabIndex = 3; - this.tpAAC.Text = "AAC"; - this.tpAAC.UseVisualStyleBackColor = true; - // - // tbAACBitrate - // - this.tbAACBitrate.BackColor = System.Drawing.Color.White; - this.tbAACBitrate.Dock = System.Windows.Forms.DockStyle.Right; - this.tbAACBitrate.LargeChange = 32; - this.tbAACBitrate.Location = new System.Drawing.Point(72, 3); - this.tbAACBitrate.Maximum = 320; - this.tbAACBitrate.Minimum = 32; - this.tbAACBitrate.Name = "tbAACBitrate"; - this.tbAACBitrate.Size = new System.Drawing.Size(237, 40); - this.tbAACBitrate.SmallChange = 32; - this.tbAACBitrate.TabIndex = 1; - this.tbAACBitrate.TickFrequency = 32; - this.tbAACBitrate.TickStyle = System.Windows.Forms.TickStyle.Both; - this.tbAACBitrate.Value = 64; - this.tbAACBitrate.Scroll += new System.EventHandler(this.tbAACBitrate_Scroll); - // - // lblAACQuality - // - this.lblAACQuality.AutoSize = true; - this.lblAACQuality.Location = new System.Drawing.Point(8, 16); - this.lblAACQuality.Name = "lblAACQuality"; - this.lblAACQuality.Size = new System.Drawing.Size(40, 13); - this.lblAACQuality.TabIndex = 0; - this.lblAACQuality.Text = "Bitrate:"; - // // FFmpegOptionsForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -696,15 +704,15 @@ private void InitializeComponent() this.tpMP3.ResumeLayout(false); this.tpMP3.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.tbMP3_qscale)).EndInit(); + this.tpAAC.ResumeLayout(false); + this.tpAAC.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.tbAACBitrate)).EndInit(); this.gbSource.ResumeLayout(false); this.gbSource.PerformLayout(); this.gbCodecs.ResumeLayout(false); this.gbCodecs.PerformLayout(); this.gbContainer.ResumeLayout(false); this.gbContainer.PerformLayout(); - this.tpAAC.ResumeLayout(false); - this.tpAAC.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.tbAACBitrate)).EndInit(); this.ResumeLayout(false); } diff --git a/ScreenCaptureLib/Screencast/FFmpegOptionsForm.cs b/ScreenCaptureLib/Screencast/FFmpegOptionsForm.cs index f94a312da..e4a5b8ff6 100644 --- a/ScreenCaptureLib/Screencast/FFmpegOptionsForm.cs +++ b/ScreenCaptureLib/Screencast/FFmpegOptionsForm.cs @@ -176,8 +176,6 @@ public void UpdateExtensions() cbExtension.Items.Add("avi"); cbExtension.SelectedIndex = 0; - - tcFFmpegVideoCodecs.SelectedIndex = (int)Options.FFmpeg.VideoCodec; } private void UpdateUI() diff --git a/ScreenCaptureLib/Screencast/FFmpegOptionsForm.resx b/ScreenCaptureLib/Screencast/FFmpegOptionsForm.resx index 93beca915..0839679e7 100644 --- a/ScreenCaptureLib/Screencast/FFmpegOptionsForm.resx +++ b/ScreenCaptureLib/Screencast/FFmpegOptionsForm.resx @@ -121,8 +121,8 @@ 17, 17 - Constant Rate Factor (CRF): The range of the quantizer scale is 0-51: where 0 is lossless, 23 is default, and 51 is worst possible. -A lower value is a higher quality and a subjectively sane range is 18-28. + Constant Rate Factor (CRF): The range of the quantizer scale is 0-51: where 0 is lossless, 23 is default, and 51 is worst possible. +A lower value is a higher quality and a subjectively sane range is 18-28. Consider 18 to be visually lossless or nearly so: it should look the same or nearly the same as the input but it isn't technically lossless. \ No newline at end of file diff --git a/ScreenCaptureLib/Screencast/ScreencastOptions.cs b/ScreenCaptureLib/Screencast/ScreencastOptions.cs index 92d7d3ea0..0c3c4137c 100644 --- a/ScreenCaptureLib/Screencast/ScreencastOptions.cs +++ b/ScreenCaptureLib/Screencast/ScreencastOptions.cs @@ -124,10 +124,17 @@ public string GetFFmpegArgs() if (FFmpeg.IsAudioSourceSelected()) { - string audioString = GetAudioString(); - if (!string.IsNullOrEmpty(audioString)) + switch (FFmpeg.AudioCodec) { - args.Append(audioString); + case FFmpegAudioCodec.libvorbis: // http://trac.ffmpeg.org/wiki/TheoraVorbisEncodingGuide + args.AppendFormat("-c:a {0} -qscale:a {1} ", FFmpegAudioCodec.libvorbis.ToString(), FFmpeg.Vorbis_qscale); + break; + case FFmpegAudioCodec.libmp3lame: // http://trac.ffmpeg.org/wiki/Encoding%20VBR%20(Variable%20Bit%20Rate)%20mp3%20audio + args.AppendFormat("-c:a {0} -qscale:a {1} ", FFmpegAudioCodec.libmp3lame.ToString(), FFmpeg.MP3_qscale); + break; + case FFmpegAudioCodec.libvoaacenc: // http://trac.ffmpeg.org/wiki/AACEncodingGuide + args.AppendFormat("-ac 2 -c:a libvo_aacenc -b:a {0}k ", FFmpeg.AAC_bitrate); // -ac 2 required otherwise failing with 7.1 + break; } } @@ -143,25 +150,5 @@ public string GetFFmpegArgs() return args.ToString(); } - - private string GetAudioString() - { - StringBuilder sbAudioString = new StringBuilder(); - - switch (FFmpeg.AudioCodec) - { - case FFmpegAudioCodec.libvorbis: - sbAudioString.AppendFormat("-c:a {0} -qscale:a {1} ", FFmpegAudioCodec.libvorbis.ToString(), FFmpeg.Vorbis_qscale); - break; - case FFmpegAudioCodec.libmp3lame: - sbAudioString.AppendFormat("-c:a {0} -qscale:a {1} ", FFmpegAudioCodec.libmp3lame.ToString(), FFmpeg.MP3_qscale); - break; - case FFmpegAudioCodec.libvoaacenc: - sbAudioString.AppendFormat("-ac 2 -c:a {0} -b:a {1}k ", "libvo_aacenc", FFmpeg.AAC_bitrate); - break; - } - - return sbAudioString.ToString(); - } } } \ No newline at end of file