mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-04 12:14:45 +13:00
Few FFmpeg changes
This commit is contained in:
parent
c1fa7ae07f
commit
ad8419cea9
5 changed files with 53 additions and 43 deletions
1
HelpersLib/Forms/OutputBox.Designer.cs
generated
1
HelpersLib/Forms/OutputBox.Designer.cs
generated
|
@ -45,6 +45,7 @@ private void InitializeComponent()
|
|||
this.txtText.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||
this.txtText.Size = new System.Drawing.Size(784, 562);
|
||||
this.txtText.TabIndex = 0;
|
||||
this.txtText.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txtText_KeyUp);
|
||||
//
|
||||
// OutputBox
|
||||
//
|
||||
|
|
|
@ -43,5 +43,13 @@ private void OutputBox_Shown(object sender, EventArgs e)
|
|||
txtText.SelectionStart = txtText.TextLength;
|
||||
txtText.ScrollToCaret();
|
||||
}
|
||||
|
||||
private void txtText_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Escape)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -50,6 +50,7 @@ private void InitializeComponent()
|
|||
this.btnFFmpegBrowse = new System.Windows.Forms.Button();
|
||||
this.txtFFmpegPath = new System.Windows.Forms.TextBox();
|
||||
this.gbCommandLinePreview = new System.Windows.Forms.GroupBox();
|
||||
this.cbCustomCommands = new System.Windows.Forms.CheckBox();
|
||||
this.txtCommandLinePreview = new System.Windows.Forms.TextBox();
|
||||
this.gbCommandLineArgs = new System.Windows.Forms.GroupBox();
|
||||
this.btnFFmpegHelp = new System.Windows.Forms.Button();
|
||||
|
@ -79,7 +80,6 @@ private void InitializeComponent()
|
|||
this.gbContainer = new System.Windows.Forms.GroupBox();
|
||||
this.btnRefreshSources = new System.Windows.Forms.Button();
|
||||
this.cbShowError = new System.Windows.Forms.CheckBox();
|
||||
this.cbCustomCommands = new System.Windows.Forms.CheckBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nudx264CRF)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nudQscale)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nudVPxCRF)).BeginInit();
|
||||
|
@ -181,12 +181,12 @@ private void InitializeComponent()
|
|||
//
|
||||
this.nudVPxCRF.Location = new System.Drawing.Point(56, 12);
|
||||
this.nudVPxCRF.Maximum = new decimal(new int[] {
|
||||
15,
|
||||
63,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.nudVPxCRF.Minimum = new decimal(new int[] {
|
||||
1,
|
||||
4,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
|
@ -287,7 +287,7 @@ private void InitializeComponent()
|
|||
this.cboVideoCodec.FormattingEnabled = true;
|
||||
this.cboVideoCodec.Location = new System.Drawing.Point(88, 22);
|
||||
this.cboVideoCodec.Name = "cboVideoCodec";
|
||||
this.cboVideoCodec.Size = new System.Drawing.Size(136, 21);
|
||||
this.cboVideoCodec.Size = new System.Drawing.Size(88, 21);
|
||||
this.cboVideoCodec.TabIndex = 1;
|
||||
this.cboVideoCodec.SelectedIndexChanged += new System.EventHandler(this.cboVideoCodec_SelectedIndexChanged);
|
||||
//
|
||||
|
@ -361,6 +361,17 @@ private void InitializeComponent()
|
|||
this.gbCommandLinePreview.TabStop = false;
|
||||
this.gbCommandLinePreview.Text = "Command line preview";
|
||||
//
|
||||
// cbCustomCommands
|
||||
//
|
||||
this.cbCustomCommands.AutoSize = true;
|
||||
this.cbCustomCommands.Location = new System.Drawing.Point(280, 0);
|
||||
this.cbCustomCommands.Name = "cbCustomCommands";
|
||||
this.cbCustomCommands.Size = new System.Drawing.Size(136, 17);
|
||||
this.cbCustomCommands.TabIndex = 1;
|
||||
this.cbCustomCommands.Text = "Use custom commands";
|
||||
this.cbCustomCommands.UseVisualStyleBackColor = true;
|
||||
this.cbCustomCommands.CheckedChanged += new System.EventHandler(this.cbCustomCommands_CheckedChanged);
|
||||
//
|
||||
// txtCommandLinePreview
|
||||
//
|
||||
this.txtCommandLinePreview.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
|
@ -562,7 +573,7 @@ private void InitializeComponent()
|
|||
this.cboVideoSource.FormattingEnabled = true;
|
||||
this.cboVideoSource.Location = new System.Drawing.Point(88, 22);
|
||||
this.cboVideoSource.Name = "cboVideoSource";
|
||||
this.cboVideoSource.Size = new System.Drawing.Size(136, 21);
|
||||
this.cboVideoSource.Size = new System.Drawing.Size(184, 21);
|
||||
this.cboVideoSource.TabIndex = 1;
|
||||
this.cboVideoSource.SelectedIndexChanged += new System.EventHandler(this.cboVideoSource_SelectedIndexChanged);
|
||||
//
|
||||
|
@ -581,7 +592,7 @@ private void InitializeComponent()
|
|||
this.cboAudioSource.FormattingEnabled = true;
|
||||
this.cboAudioSource.Location = new System.Drawing.Point(88, 52);
|
||||
this.cboAudioSource.Name = "cboAudioSource";
|
||||
this.cboAudioSource.Size = new System.Drawing.Size(136, 21);
|
||||
this.cboAudioSource.Size = new System.Drawing.Size(184, 21);
|
||||
this.cboAudioSource.TabIndex = 3;
|
||||
this.cboAudioSource.SelectedIndexChanged += new System.EventHandler(this.cboAudioSource_SelectedIndexChanged);
|
||||
//
|
||||
|
@ -600,7 +611,7 @@ private void InitializeComponent()
|
|||
this.cboAudioCodec.FormattingEnabled = true;
|
||||
this.cboAudioCodec.Location = new System.Drawing.Point(88, 52);
|
||||
this.cboAudioCodec.Name = "cboAudioCodec";
|
||||
this.cboAudioCodec.Size = new System.Drawing.Size(136, 21);
|
||||
this.cboAudioCodec.Size = new System.Drawing.Size(88, 21);
|
||||
this.cboAudioCodec.TabIndex = 3;
|
||||
this.cboAudioCodec.SelectedIndexChanged += new System.EventHandler(this.cboAudioCodec_SelectedIndexChanged);
|
||||
//
|
||||
|
@ -621,7 +632,7 @@ private void InitializeComponent()
|
|||
this.gbSource.Controls.Add(this.lblAudioSource);
|
||||
this.gbSource.Location = new System.Drawing.Point(8, 8);
|
||||
this.gbSource.Name = "gbSource";
|
||||
this.gbSource.Size = new System.Drawing.Size(232, 88);
|
||||
this.gbSource.Size = new System.Drawing.Size(280, 88);
|
||||
this.gbSource.TabIndex = 1;
|
||||
this.gbSource.TabStop = false;
|
||||
this.gbSource.Text = "Sources";
|
||||
|
@ -632,9 +643,9 @@ private void InitializeComponent()
|
|||
this.gbCodecs.Controls.Add(this.lblAudioCodec);
|
||||
this.gbCodecs.Controls.Add(this.cboVideoCodec);
|
||||
this.gbCodecs.Controls.Add(this.lblCodec);
|
||||
this.gbCodecs.Location = new System.Drawing.Point(248, 8);
|
||||
this.gbCodecs.Location = new System.Drawing.Point(296, 8);
|
||||
this.gbCodecs.Name = "gbCodecs";
|
||||
this.gbCodecs.Size = new System.Drawing.Size(232, 88);
|
||||
this.gbCodecs.Size = new System.Drawing.Size(184, 88);
|
||||
this.gbCodecs.TabIndex = 2;
|
||||
this.gbCodecs.TabStop = false;
|
||||
this.gbCodecs.Text = "Codecs";
|
||||
|
@ -652,7 +663,7 @@ private void InitializeComponent()
|
|||
//
|
||||
// btnRefreshSources
|
||||
//
|
||||
this.btnRefreshSources.Location = new System.Drawing.Point(177, 4);
|
||||
this.btnRefreshSources.Location = new System.Drawing.Point(225, 4);
|
||||
this.btnRefreshSources.Name = "btnRefreshSources";
|
||||
this.btnRefreshSources.Size = new System.Drawing.Size(56, 23);
|
||||
this.btnRefreshSources.TabIndex = 0;
|
||||
|
@ -665,23 +676,12 @@ private void InitializeComponent()
|
|||
this.cbShowError.AutoSize = true;
|
||||
this.cbShowError.Location = new System.Drawing.Point(9, 424);
|
||||
this.cbShowError.Name = "cbShowError";
|
||||
this.cbShowError.Size = new System.Drawing.Size(295, 17);
|
||||
this.cbShowError.Size = new System.Drawing.Size(274, 17);
|
||||
this.cbShowError.TabIndex = 11;
|
||||
this.cbShowError.Text = "If recording or encoding fail then show error message box";
|
||||
this.cbShowError.Text = "If recording or encoding fails then show error window";
|
||||
this.cbShowError.UseVisualStyleBackColor = true;
|
||||
this.cbShowError.CheckedChanged += new System.EventHandler(this.cbShowError_CheckedChanged);
|
||||
//
|
||||
// cbCustomCommands
|
||||
//
|
||||
this.cbCustomCommands.AutoSize = true;
|
||||
this.cbCustomCommands.Location = new System.Drawing.Point(280, 0);
|
||||
this.cbCustomCommands.Name = "cbCustomCommands";
|
||||
this.cbCustomCommands.Size = new System.Drawing.Size(136, 17);
|
||||
this.cbCustomCommands.TabIndex = 1;
|
||||
this.cbCustomCommands.Text = "Use custom commands";
|
||||
this.cbCustomCommands.UseVisualStyleBackColor = true;
|
||||
this.cbCustomCommands.CheckedChanged += new System.EventHandler(this.cbCustomCommands_CheckedChanged);
|
||||
//
|
||||
// FFmpegOptionsForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -707,7 +707,7 @@ private void InitializeComponent()
|
|||
this.Name = "FFmpegOptionsForm";
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "FFmpegGUI";
|
||||
this.Text = "ShareX - FFmpeg options";
|
||||
this.HelpButtonClicked += new System.ComponentModel.CancelEventHandler(this.FFmpegOptionsForm_HelpButtonClicked);
|
||||
((System.ComponentModel.ISupportInitialize)(this.nudx264CRF)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nudQscale)).EndInit();
|
||||
|
|
|
@ -41,9 +41,7 @@ public partial class FFmpegOptionsForm : Form
|
|||
public FFmpegOptionsForm(ScreencastOptions options)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Icon = ShareXResources.Icon;
|
||||
Text = string.Format("{0} - FFmpeg Options", Application.ProductName);
|
||||
|
||||
Options = options;
|
||||
|
||||
|
@ -292,6 +290,7 @@ private void DownloaderForm_InstallRequested(string filePath)
|
|||
RefreshSourcesAsync();
|
||||
UpdateUI();
|
||||
});
|
||||
|
||||
MessageBox.Show("Successfully downloaded FFmpeg.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -48,28 +48,30 @@ public class ScreencastOptions
|
|||
|
||||
public string GetFFmpegCommands()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(FFmpeg.VideoSource) && !FFmpeg.VideoSource.Equals(FFmpegHelper.GDIgrab, StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!string.IsNullOrEmpty(FFmpeg.VideoSource) && FFmpeg.VideoSource.Equals("screen-capture-recorder", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
// https://github.com/rdp/screen-capture-recorder-to-video-windows-free configuration section
|
||||
string dshowRegistryPath = "Software\\screen-capture-recorder";
|
||||
RegistryHelpers.CreateRegistry(dshowRegistryPath, "start_x", CaptureArea.X);
|
||||
RegistryHelpers.CreateRegistry(dshowRegistryPath, "start_y", CaptureArea.Y);
|
||||
RegistryHelpers.CreateRegistry(dshowRegistryPath, "capture_width", CaptureArea.Width);
|
||||
RegistryHelpers.CreateRegistry(dshowRegistryPath, "capture_height", CaptureArea.Height);
|
||||
RegistryHelpers.CreateRegistry(dshowRegistryPath, "default_max_fps", ScreenRecordFPS);
|
||||
RegistryHelpers.CreateRegistry(dshowRegistryPath, "capture_mouse_default_1", DrawCursor ? 1 : 0);
|
||||
// https://github.com/rdp/screen-capture-recorder-to-video-windows-free
|
||||
string registryPath = "Software\\screen-capture-recorder";
|
||||
RegistryHelpers.CreateRegistry(registryPath, "start_x", CaptureArea.X);
|
||||
RegistryHelpers.CreateRegistry(registryPath, "start_y", CaptureArea.Y);
|
||||
RegistryHelpers.CreateRegistry(registryPath, "capture_width", CaptureArea.Width);
|
||||
RegistryHelpers.CreateRegistry(registryPath, "capture_height", CaptureArea.Height);
|
||||
RegistryHelpers.CreateRegistry(registryPath, "default_max_fps", ScreenRecordFPS);
|
||||
RegistryHelpers.CreateRegistry(registryPath, "capture_mouse_default_1", DrawCursor ? 1 : 0);
|
||||
}
|
||||
|
||||
if (FFmpeg.UseCustomCommands)
|
||||
if (FFmpeg.UseCustomCommands && !string.IsNullOrEmpty(FFmpeg.CustomCommands))
|
||||
{
|
||||
string commands = FFmpeg.CustomCommands;
|
||||
int lastIndex = commands.LastIndexOf('"');
|
||||
if (lastIndex >= 0)
|
||||
string commands = FFmpeg.CustomCommands.Trim();
|
||||
|
||||
// Replace output path
|
||||
if (commands[commands.Length - 1] == '"')
|
||||
{
|
||||
lastIndex = commands.LastIndexOf('"', lastIndex - 1);
|
||||
if (lastIndex >= 0)
|
||||
int index = commands.LastIndexOf('"', commands.Length - 2);
|
||||
|
||||
if (index >= 0)
|
||||
{
|
||||
commands = commands.Remove(lastIndex);
|
||||
commands = commands.Remove(index);
|
||||
commands += string.Format("\"{0}\"", Path.ChangeExtension(OutputPath, FFmpeg.Extension));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue