From 06bcc15785edeba6eaf3a5bbbee634292eabddf8 Mon Sep 17 00:00:00 2001 From: Jaex Date: Sat, 12 Sep 2015 23:32:51 +0300 Subject: [PATCH] Added FFmpeg override path setting for Steam build so it can use built in FFmpeg by default --- .gitignore | 4 +- .../Screencast/FFmpegHelper.cs | 12 +- .../Screencast/FFmpegOptions.cs | 28 +- .../Screencast/FFmpegOptionsForm.Designer.cs | 13 +- .../Screencast/FFmpegOptionsForm.cs | 59 +- .../Screencast/FFmpegOptionsForm.resx | 990 ++++++++++++------ .../ShareX.ScreenCaptureLib.csproj | 4 +- ShareX.Setup/Program.cs | 7 + ShareX/TaskHelpers.cs | 11 +- 9 files changed, 764 insertions(+), 364 deletions(-) diff --git a/.gitignore b/.gitignore index f31c887ff..3726d941f 100644 --- a/.gitignore +++ b/.gitignore @@ -198,4 +198,6 @@ FakesAssemblies/ # Additional InnoSetup/Output/ ShareX/GitHash.txt -ShareX.UploadersLib/APIKeys/APIKeysLocal.cs \ No newline at end of file +ShareX.UploadersLib/APIKeys/APIKeysLocal.cs +Lib/ffmpeg.exe +Lib/ffmpeg-x64.exe diff --git a/ShareX.ScreenCaptureLib/Screencast/FFmpegHelper.cs b/ShareX.ScreenCaptureLib/Screencast/FFmpegHelper.cs index 4678920ee..4acffbc3c 100644 --- a/ShareX.ScreenCaptureLib/Screencast/FFmpegHelper.cs +++ b/ShareX.ScreenCaptureLib/Screencast/FFmpegHelper.cs @@ -80,7 +80,7 @@ private void FFmpegHelper_DataReceived(object sender, DataReceivedEventArgs e) public bool Record() { recordingStarted = false; - return Run(Options.FFmpeg.CLIPath, Options.GetFFmpegCommands()); + return Run(Options.FFmpeg.FFmpegPath, Options.GetFFmpegCommands()); } protected void OnRecordingStarted() @@ -95,17 +95,17 @@ public bool EncodeGIF(string input, string output) { bool result; - string palettePath = Path.Combine(Path.GetDirectoryName(Options.FFmpeg.CLIPath), "palette.png"); + string palettePath = Path.Combine(Path.GetDirectoryName(Options.FFmpeg.FFmpegPath), "palette.png"); try { // https://ffmpeg.org/ffmpeg-filters.html#palettegen-1 - result = Run(Options.FFmpeg.CLIPath, string.Format("-y -i \"{0}\" -vf \"palettegen=stats_mode={2}\" \"{1}\"", input, palettePath, Options.FFmpeg.GIFStatsMode)); + result = Run(Options.FFmpeg.FFmpegPath, string.Format("-y -i \"{0}\" -vf \"palettegen=stats_mode={2}\" \"{1}\"", input, palettePath, Options.FFmpeg.GIFStatsMode)); if (result) { // https://ffmpeg.org/ffmpeg-filters.html#paletteuse - result = Run(Options.FFmpeg.CLIPath, string.Format("-y -i \"{0}\" -i \"{1}\" -lavfi \"paletteuse=dither={3}\" \"{2}\"", input, palettePath, output, Options.FFmpeg.GIFDither)); + result = Run(Options.FFmpeg.FFmpegPath, string.Format("-y -i \"{0}\" -i \"{1}\" -lavfi \"paletteuse=dither={3}\" \"{2}\"", input, palettePath, output, Options.FFmpeg.GIFDither)); } } finally @@ -134,10 +134,10 @@ public DirectShowDevices GetDirectShowDevices() { DirectShowDevices devices = new DirectShowDevices(); - if (File.Exists(Options.FFmpeg.CLIPath)) + if (File.Exists(Options.FFmpeg.FFmpegPath)) { string arg = "-list_devices true -f dshow -i dummy"; - Open(Options.FFmpeg.CLIPath, arg); + Open(Options.FFmpeg.FFmpegPath, arg); string output = Output.ToString(); string[] lines = output.Lines(); bool isVideo = true; diff --git a/ShareX.ScreenCaptureLib/Screencast/FFmpegOptions.cs b/ShareX.ScreenCaptureLib/Screencast/FFmpegOptions.cs index 9c2eb8923..1fa1c3d7c 100644 --- a/ShareX.ScreenCaptureLib/Screencast/FFmpegOptions.cs +++ b/ShareX.ScreenCaptureLib/Screencast/FFmpegOptions.cs @@ -23,6 +23,7 @@ #endregion License Information (GPL v3) +using ShareX.HelpersLib; using System; namespace ShareX.ScreenCaptureLib @@ -30,11 +31,12 @@ namespace ShareX.ScreenCaptureLib public class FFmpegOptions { // General + public bool OverrideCLIPath { get; set; } + public string CLIPath { get; set; } public string VideoSource { get; set; } public string AudioSource { get; set; } public FFmpegVideoCodec VideoCodec { get; set; } public FFmpegAudioCodec AudioCodec { get; set; } - public string CLIPath { get; set; } public string UserArgs { get; set; } public bool UseCustomCommands { get; set; } public string CustomCommands { get; set; } @@ -53,6 +55,28 @@ public class FFmpegOptions public int Vorbis_qscale { get; set; } public int MP3_qscale { get; set; } + public string FFmpegPath + { + get + { +#if STEAM + if (!OverrideCLIPath) + { + if (NativeMethods.Is64Bit()) + { + return Helpers.GetAbsolutePath("ffmpeg-x64.exe"); + } + else + { + return Helpers.GetAbsolutePath("ffmpeg.exe"); + } + } +#endif + + return CLIPath; + } + } + public string Extension { get @@ -116,11 +140,11 @@ public bool IsAudioSourceSelected public FFmpegOptions() { // General + OverrideCLIPath = false; VideoSource = FFmpegHelper.SourceGDIGrab; AudioSource = FFmpegHelper.SourceNone; VideoCodec = FFmpegVideoCodec.libx264; AudioCodec = FFmpegAudioCodec.libvoaacenc; - CLIPath = "ffmpeg.exe"; UserArgs = ""; ShowError = true; diff --git a/ShareX.ScreenCaptureLib/Screencast/FFmpegOptionsForm.Designer.cs b/ShareX.ScreenCaptureLib/Screencast/FFmpegOptionsForm.Designer.cs index 8614b393f..f4c51cae2 100644 --- a/ShareX.ScreenCaptureLib/Screencast/FFmpegOptionsForm.Designer.cs +++ b/ShareX.ScreenCaptureLib/Screencast/FFmpegOptionsForm.Designer.cs @@ -45,6 +45,7 @@ private void InitializeComponent() this.lblx264Preset = new System.Windows.Forms.Label(); this.lblXvidQscale = new System.Windows.Forms.Label(); this.gbFFmpegExe = new System.Windows.Forms.GroupBox(); + this.cbOverrideFFmpegPath = new System.Windows.Forms.CheckBox(); this.btnDownload = new System.Windows.Forms.Button(); this.btnFFmpegBrowse = new System.Windows.Forms.Button(); this.txtFFmpegPath = new System.Windows.Forms.TextBox(); @@ -259,6 +260,13 @@ private void InitializeComponent() this.gbFFmpegExe.Name = "gbFFmpegExe"; this.gbFFmpegExe.TabStop = false; // + // cbOverrideFFmpegPath + // + resources.ApplyResources(this.cbOverrideFFmpegPath, "cbOverrideFFmpegPath"); + this.cbOverrideFFmpegPath.Name = "cbOverrideFFmpegPath"; + this.cbOverrideFFmpegPath.UseVisualStyleBackColor = true; + this.cbOverrideFFmpegPath.CheckedChanged += new System.EventHandler(this.cbOverrideFFmpegPath_CheckedChanged); + // // btnDownload // resources.ApplyResources(this.btnDownload, "btnDownload"); @@ -277,7 +285,7 @@ private void InitializeComponent() // resources.ApplyResources(this.txtFFmpegPath, "txtFFmpegPath"); this.txtFFmpegPath.Name = "txtFFmpegPath"; - this.txtFFmpegPath.TextChanged += new System.EventHandler(this.tbFFmpegPath_TextChanged); + this.txtFFmpegPath.TextChanged += new System.EventHandler(this.txtFFmpegPath_TextChanged); // // gbCommandLinePreview // @@ -590,6 +598,7 @@ private void InitializeComponent() resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; + this.Controls.Add(this.cbOverrideFFmpegPath); this.Controls.Add(this.eiFFmpeg); this.Controls.Add(this.btnHelp); this.Controls.Add(this.gbCodecs); @@ -637,6 +646,7 @@ private void InitializeComponent() this.gbCodecs.ResumeLayout(false); this.gbCodecs.PerformLayout(); this.ResumeLayout(false); + this.PerformLayout(); } @@ -699,5 +709,6 @@ private void InitializeComponent() private System.Windows.Forms.Button btnHelperDevicesHelp; private System.Windows.Forms.Label lblHelperDevices; private System.Windows.Forms.Button btnInstallHelperDevices; + private System.Windows.Forms.CheckBox cbOverrideFFmpegPath; } } \ No newline at end of file diff --git a/ShareX.ScreenCaptureLib/Screencast/FFmpegOptionsForm.cs b/ShareX.ScreenCaptureLib/Screencast/FFmpegOptionsForm.cs index b76300531..34e5d97b9 100644 --- a/ShareX.ScreenCaptureLib/Screencast/FFmpegOptionsForm.cs +++ b/ShareX.ScreenCaptureLib/Screencast/FFmpegOptionsForm.cs @@ -60,20 +60,22 @@ private void SettingsLoad() settingsLoaded = false; // General + +#if STEAM + cbOverrideFFmpegPath.Checked = Options.FFmpeg.OverrideCLIPath; + gbFFmpegExe.Enabled = Options.FFmpeg.OverrideCLIPath; +#else + cbOverrideFFmpegPath.Visible = false; +#endif + + txtFFmpegPath.Text = Options.FFmpeg.CLIPath; + txtFFmpegPath.SelectionStart = txtFFmpegPath.TextLength; + RefreshSourcesAsync(); cboVideoCodec.SelectedIndex = (int)Options.FFmpeg.VideoCodec; cboAudioCodec.SelectedIndex = (int)Options.FFmpeg.AudioCodec; - string cli = "ffmpeg.exe"; - if (string.IsNullOrEmpty(Options.FFmpeg.CLIPath) && File.Exists(cli)) - { - Options.FFmpeg.CLIPath = cli; - } - - txtFFmpegPath.Text = Options.FFmpeg.CLIPath; - txtFFmpegPath.SelectionStart = txtFFmpegPath.TextLength; - tbUserArgs.Text = Options.FFmpeg.UserArgs; // x264 @@ -170,6 +172,27 @@ private void UpdateUI() } } + private void cbOverrideFFmpegPath_CheckedChanged(object sender, EventArgs e) + { +#if STEAM + Options.FFmpeg.OverrideCLIPath = cbOverrideFFmpegPath.Checked; + gbFFmpegExe.Enabled = Options.FFmpeg.OverrideCLIPath; +#endif + } + + private void txtFFmpegPath_TextChanged(object sender, EventArgs e) + { + Options.FFmpeg.CLIPath = txtFFmpegPath.Text; + } + + private void buttonFFmpegBrowse_Click(object sender, EventArgs e) + { + if (Helpers.BrowseFile(Resources.FFmpegOptionsForm_buttonFFmpegBrowse_Click_Browse_for_ffmpeg_exe, txtFFmpegPath, Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles))) + { + RefreshSourcesAsync(); + } + } + private void btnRefreshSources_Click(object sender, EventArgs e) { RefreshSourcesAsync(); @@ -327,20 +350,6 @@ private void tbMP3_qscale_ValueChanged(object sender, EventArgs e) UpdateUI(); } - private void tbFFmpegPath_TextChanged(object sender, EventArgs e) - { - Options.FFmpeg.CLIPath = txtFFmpegPath.Text; - txtFFmpegPath.BackColor = File.Exists(txtFFmpegPath.Text) ? Color.FromArgb(200, 255, 200) : Color.FromArgb(255, 200, 200); - } - - private void buttonFFmpegBrowse_Click(object sender, EventArgs e) - { - if (Helpers.BrowseFile(Resources.FFmpegOptionsForm_buttonFFmpegBrowse_Click_Browse_for_ffmpeg_exe, txtFFmpegPath, Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles))) - { - RefreshSourcesAsync(); - } - } - private void tbUserArgs_TextChanged(object sender, EventArgs e) { Options.FFmpeg.UserArgs = tbUserArgs.Text; @@ -381,7 +390,7 @@ private void DownloaderForm_InstallRequested(string filePath) private void btnTest_Click(object sender, EventArgs e) { - if (File.Exists(Options.FFmpeg.CLIPath)) + if (File.Exists(Options.FFmpeg.FFmpegPath)) { try { @@ -389,7 +398,7 @@ private void btnTest_Click(object sender, EventArgs e) { ProcessStartInfo psi = new ProcessStartInfo("cmd.exe"); psi.Arguments = "/k ffmpeg " + Options.GetFFmpegCommands(); - psi.WorkingDirectory = Path.GetDirectoryName(Options.FFmpeg.CLIPath); + psi.WorkingDirectory = Path.GetDirectoryName(Options.FFmpeg.FFmpegPath); process.StartInfo = psi; process.Start(); diff --git a/ShareX.ScreenCaptureLib/Screencast/FFmpegOptionsForm.resx b/ShareX.ScreenCaptureLib/Screencast/FFmpegOptionsForm.resx index 1eefde624..3410fbcaf 100644 --- a/ShareX.ScreenCaptureLib/Screencast/FFmpegOptionsForm.resx +++ b/ShareX.ScreenCaptureLib/Screencast/FFmpegOptionsForm.resx @@ -133,7 +133,7 @@ CRF: - @Invariant + lblx264CRF @@ -146,6 +146,9 @@ 1 + + 17, 17 + 144, 12 @@ -159,9 +162,6 @@ Center - - 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. @@ -182,6 +182,9 @@ If the output looks good, then try a higher value and if it looks bad then choos 0 + + 17, 17 + 144, 12 @@ -466,18 +469,6 @@ Similarly, for constant quality encoding, you will simply save bitrate by choosi 1 - - 552, 22 - - - 88, 24 - - - 2 - - - Download - btnDownload @@ -490,18 +481,6 @@ Similarly, for constant quality encoding, you will simply save bitrate by choosi 0 - - 512, 22 - - - 32, 24 - - - 1 - - - ... - @Invariant btnFFmpegBrowse @@ -514,15 +493,6 @@ Similarly, for constant quality encoding, you will simply save bitrate by choosi 1 - - 8, 24 - - - 496, 20 - - - 0 - txtFFmpegPath @@ -557,6 +527,153 @@ Similarly, for constant quality encoding, you will simply save bitrate by choosi $this + 8 + + + True + + + 120, 8 + + + 106, 17 + + + 3 + + + Use custom path + + + cbOverrideFFmpegPath + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + + + 552, 22 + + + 88, 24 + + + 2 + + + Download + + + btnDownload + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gbFFmpegExe + + + 0 + + + 512, 22 + + + 32, 24 + + + 1 + + + ... + + + btnFFmpegBrowse + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gbFFmpegExe + + + 1 + + + 8, 24 + + + 496, 20 + + + 0 + + + txtFFmpegPath + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gbFFmpegExe + + + 2 + + + cbCustomCommands + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gbCommandLinePreview + + + 0 + + + txtCommandLinePreview + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gbCommandLinePreview + + + 1 + + + 8, 409 + + + 8, 8, 8, 8 + + + 648, 96 + + + 6 + + + Command line preview + + + gbCommandLinePreview + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + 7 @@ -619,48 +736,6 @@ Similarly, for constant quality encoding, you will simply save bitrate by choosi 1 - - 8, 409 - - - 8, 8, 8, 8 - - - 648, 96 - - - 6 - - - Command line preview - - - gbCommandLinePreview - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 6 - - - Top, Right - - - 616, 23 - - - 24, 23 - - - 1 - - - ? - @Invariant btnFFmpegHelp @@ -673,18 +748,6 @@ Similarly, for constant quality encoding, you will simply save bitrate by choosi 0 - - Top, Left, Right - - - 8, 24 - - - 600, 20 - - - 0 - tbUserArgs @@ -719,7 +782,127 @@ Similarly, for constant quality encoding, you will simply save bitrate by choosi $this - 8 + 9 + + + Top, Right + + + 616, 23 + + + 24, 23 + + + 1 + + + ? + + + btnFFmpegHelp + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gbCommandLineArgs + + + 0 + + + Top, Left, Right + + + 8, 24 + + + 600, 20 + + + 0 + + + tbUserArgs + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gbCommandLineArgs + + + 1 + + + tpX264 + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tcFFmpegVideoCodecs + + + 0 + + + tpVpx + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tcFFmpegVideoCodecs + + + 1 + + + tpXvid + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tcFFmpegVideoCodecs + + + 2 + + + tpGIF + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tcFFmpegVideoCodecs + + + 3 + + + 8, 56 + + + 312, 96 + + + 3 + + + tcFFmpegVideoCodecs + + + System.Windows.Forms.TabControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gbCodecs + + + 5 4, 22 @@ -735,7 +918,7 @@ Similarly, for constant quality encoding, you will simply save bitrate by choosi x264 / x265 - @Invariant + tpX264 @@ -748,6 +931,66 @@ Similarly, for constant quality encoding, you will simply save bitrate by choosi 0 + + lblVP8BitrateK + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpVpx + + + 0 + + + nudVP8Bitrate + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpVpx + + + 1 + + + lblVP8Bitrate + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpVpx + + + 2 + + + 4, 22 + + + 304, 70 + + + 2 + + + VP8 + + + tpVpx + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tcFFmpegVideoCodecs + + + 1 + True @@ -765,7 +1008,7 @@ Similarly, for constant quality encoding, you will simply save bitrate by choosi kbit/s - @Invariant + lblVP8BitrateK @@ -829,30 +1072,6 @@ Similarly, for constant quality encoding, you will simply save bitrate by choosi 2 - - 4, 22 - - - 304, 70 - - - 2 - - - VP8 - @Invariant - - tpVpx - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tcFFmpegVideoCodecs - - - 1 - 4, 22 @@ -864,7 +1083,7 @@ Similarly, for constant quality encoding, you will simply save bitrate by choosi Xvid - @Invariant + tpXvid @@ -877,6 +1096,57 @@ Similarly, for constant quality encoding, you will simply save bitrate by choosi 2 + + lblGIFDither + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpGIF + + + 1 + + + lblGIFStatsMode + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpGIF + + + 3 + + + 4, 22 + + + 3, 3, 3, 3 + + + 304, 70 + + + 4 + + + GIF + + + tpGIF + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tcFFmpegVideoCodecs + + + 3 + True @@ -914,7 +1184,7 @@ Similarly, for constant quality encoding, you will simply save bitrate by choosi 16, 16 - 97, 13 + 72, 13 0 @@ -934,54 +1204,6 @@ Similarly, for constant quality encoding, you will simply save bitrate by choosi 3 - - 4, 22 - - - 3, 3, 3, 3 - - - 304, 70 - - - 4 - - - GIF - @Invariant - - tpGIF - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tcFFmpegVideoCodecs - - - 3 - - - 8, 56 - - - 312, 96 - - - 3 - - - tcFFmpegVideoCodecs - - - System.Windows.Forms.TabControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gbCodecs - - - 5 - 176, 404 @@ -1004,7 +1226,7 @@ Similarly, for constant quality encoding, you will simply save bitrate by choosi $this - 5 + 6 304, 404 @@ -1028,50 +1250,8 @@ Similarly, for constant quality encoding, you will simply save bitrate by choosi $this - 4 + 5 - - True - - - 16, 16 - - - 40, 13 - - - 0 - - - Bitrate: - - - lblAACQuality - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tpAAC - - - 1 - - - 4, 22 - - - 3, 3, 3, 3 - - - 304, 70 - - - 3 - - - AAC - @Invariant tpAAC @@ -1084,48 +1264,6 @@ Similarly, for constant quality encoding, you will simply save bitrate by choosi 0 - - True - - - 16, 16 - - - 42, 13 - - - 0 - - - Quality: - - - lblVorbisQuality - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tpVorbis - - - 1 - - - 4, 22 - - - 3, 3, 3, 3 - - - 304, 70 - - - 0 - - - Vorbis - @Invariant tpVorbis @@ -1138,48 +1276,6 @@ Similarly, for constant quality encoding, you will simply save bitrate by choosi 1 - - True - - - 16, 16 - - - 42, 13 - - - 0 - - - Quality: - - - lblMP3Quality - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tpMP3 - - - 1 - - - 4, 22 - - - 3, 3, 3, 3 - - - 304, 70 - - - 2 - - - MP3 - @Invariant tpMP3 @@ -1213,6 +1309,204 @@ Similarly, for constant quality encoding, you will simply save bitrate by choosi 4 + + lblAACQuality + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpAAC + + + 1 + + + 4, 22 + + + 3, 3, 3, 3 + + + 304, 70 + + + 3 + + + AAC + + + tpAAC + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tcFFmpegAudioCodecs + + + 0 + + + True + + + 16, 16 + + + 40, 13 + + + 0 + + + Bitrate: + + + lblAACQuality + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpAAC + + + 1 + + + lblVorbisQuality + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpVorbis + + + 1 + + + 4, 22 + + + 3, 3, 3, 3 + + + 304, 70 + + + 0 + + + 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: + + + lblVorbisQuality + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpVorbis + + + 1 + + + lblMP3Quality + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpMP3 + + + 1 + + + 4, 22 + + + 3, 3, 3, 3 + + + 304, 70 + + + 2 + + + MP3 + + + tpMP3 + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tcFFmpegAudioCodecs + + + 2 + + + True + + + 16, 16 + + + 42, 13 + + + 0 + + + Quality: + + + lblMP3Quality + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpMP3 + + + 1 + 184, 25 @@ -1357,6 +1651,78 @@ Similarly, for constant quality encoding, you will simply save bitrate by choosi 1 + + btnHelperDevicesHelp + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gbSource + + + 0 + + + lblHelperDevices + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gbSource + + + 1 + + + btnInstallHelperDevices + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gbSource + + + 2 + + + btnRefreshSources + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gbSource + + + 7 + + + 8, 68 + + + 648, 92 + + + 1 + + + Sources + + + gbSource + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 4 + 168, 56 @@ -1368,7 +1734,7 @@ Similarly, for constant quality encoding, you will simply save bitrate by choosi ? - @Invariant + btnHelperDevicesHelp @@ -1456,30 +1822,6 @@ Similarly, for constant quality encoding, you will simply save bitrate by choosi 7 - - 8, 68 - - - 648, 92 - - - 1 - - - Sources - - - gbSource - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 3 - 8, 168 @@ -1502,7 +1844,7 @@ Similarly, for constant quality encoding, you will simply save bitrate by choosi $this - 2 + 3 576, 512 @@ -1526,7 +1868,7 @@ Similarly, for constant quality encoding, you will simply save bitrate by choosi $this - 1 + 2 384, 512 @@ -1547,7 +1889,7 @@ Similarly, for constant quality encoding, you will simply save bitrate by choosi $this - 0 + 1 True diff --git a/ShareX.ScreenCaptureLib/ShareX.ScreenCaptureLib.csproj b/ShareX.ScreenCaptureLib/ShareX.ScreenCaptureLib.csproj index 6e621b063..5f1ae6825 100644 --- a/ShareX.ScreenCaptureLib/ShareX.ScreenCaptureLib.csproj +++ b/ShareX.ScreenCaptureLib/ShareX.ScreenCaptureLib.csproj @@ -33,7 +33,7 @@ none true bin\Release\ - TRACE + TRACE;RELEASE prompt 4 false @@ -43,7 +43,7 @@ bin\Steam\ - TRACE + TRACE;STEAM true AnyCPU Off diff --git a/ShareX.Setup/Program.cs b/ShareX.Setup/Program.cs index 1238ede6f..bdfd535e4 100644 --- a/ShareX.Setup/Program.cs +++ b/ShareX.Setup/Program.cs @@ -157,6 +157,13 @@ private static void CreatePortable(string destination) CopyFiles(Path.Combine(ReleaseDirectory, language), "*.resources.dll", Path.Combine(destination, "Languages", language)); } + if (Setup == SetupType.Steam) + { + // These git ignored + CopyFile(Path.Combine(parentDir, "Lib", "ffmpeg.exe"), destination); + CopyFile(Path.Combine(parentDir, "Lib", "ffmpeg-x64.exe"), destination); + } + CopyFile(Path.Combine(outputDir, "Recorder-devices-setup.exe"), destination); CopyFile(Path.Combine(parentDir, @"..\ShareX_Chrome\ShareX_Chrome\bin\Release\ShareX_Chrome.exe"), destination); diff --git a/ShareX/TaskHelpers.cs b/ShareX/TaskHelpers.cs index 4715e58cd..4458a8607 100644 --- a/ShareX/TaskHelpers.cs +++ b/ShareX/TaskHelpers.cs @@ -624,7 +624,7 @@ public static void OpenVideoThumbnailer(TaskSettings taskSettings = null) } taskSettings.ToolsSettings.VideoThumbnailOptions.DefaultOutputDirectory = taskSettings.CaptureFolder; - VideoThumbnailerForm thumbnailerForm = new VideoThumbnailerForm(taskSettings.CaptureSettings.FFmpegOptions.CLIPath, taskSettings.ToolsSettingsReference.VideoThumbnailOptions); + VideoThumbnailerForm thumbnailerForm = new VideoThumbnailerForm(taskSettings.CaptureSettings.FFmpegOptions.FFmpegPath, taskSettings.ToolsSettingsReference.VideoThumbnailOptions); thumbnailerForm.ThumbnailsTaken += thumbnails => { if (taskSettings.ToolsSettingsReference.VideoThumbnailOptions.UploadThumbnails) @@ -815,9 +815,9 @@ public static bool ToggleHotkeys() public static bool CheckFFmpeg(TaskSettings taskSettings) { - if (!File.Exists(taskSettings.CaptureSettings.FFmpegOptions.CLIPath)) + if (!File.Exists(taskSettings.CaptureSettings.FFmpegOptions.FFmpegPath)) { - string ffmpegText = string.IsNullOrEmpty(taskSettings.CaptureSettings.FFmpegOptions.CLIPath) ? "ffmpeg.exe" : taskSettings.CaptureSettings.FFmpegOptions.CLIPath; + string ffmpegText = string.IsNullOrEmpty(taskSettings.CaptureSettings.FFmpegOptions.FFmpegPath) ? "ffmpeg.exe" : taskSettings.CaptureSettings.FFmpegOptions.FFmpegPath; if (MessageBox.Show(string.Format(Resources.ScreenRecordForm_StartRecording_does_not_exist, ffmpegText), "ShareX - " + Resources.ScreenRecordForm_StartRecording_Missing + " ffmpeg.exe", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) @@ -826,6 +826,11 @@ public static bool CheckFFmpeg(TaskSettings taskSettings) { Program.DefaultTaskSettings.CaptureSettings.FFmpegOptions.CLIPath = taskSettings.TaskSettingsReference.CaptureSettings.FFmpegOptions.CLIPath = taskSettings.CaptureSettings.FFmpegOptions.CLIPath = Path.Combine(Program.ToolsFolder, "ffmpeg.exe"); + +#if STEAM + Program.DefaultTaskSettings.CaptureSettings.FFmpegOptions.OverrideCLIPath = taskSettings.TaskSettingsReference.CaptureSettings.FFmpegOptions.OverrideCLIPath = + taskSettings.CaptureSettings.FFmpegOptions.OverrideCLIPath = true; +#endif } } else