2014-05-10 12:23:47 +12:00
|
|
|
|
#region License Information (GPL v3)
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
ShareX - A program that allows you to take screenshots and share any file type
|
2014-05-13 21:06:40 +12:00
|
|
|
|
Copyright (C) 2007-2014 ShareX Developers
|
2014-05-10 12:23:47 +12:00
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
|
|
Optionally you can also view the license at <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#endregion License Information (GPL v3)
|
|
|
|
|
|
|
|
|
|
using HelpersLib;
|
2014-10-18 00:08:33 +13:00
|
|
|
|
using ScreenCaptureLib.Properties;
|
2014-05-09 15:14:53 +12:00
|
|
|
|
using System;
|
2014-05-12 22:56:37 +12:00
|
|
|
|
using System.Diagnostics;
|
2014-05-09 15:14:53 +12:00
|
|
|
|
using System.Drawing;
|
2014-05-09 22:25:04 +12:00
|
|
|
|
using System.IO;
|
2014-05-09 15:14:53 +12:00
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
2014-05-12 10:58:10 +12:00
|
|
|
|
namespace ScreenCaptureLib
|
2014-05-09 15:14:53 +12:00
|
|
|
|
{
|
2014-05-10 20:06:43 +12:00
|
|
|
|
public partial class FFmpegOptionsForm : Form
|
2014-05-09 15:14:53 +12:00
|
|
|
|
{
|
2014-05-12 10:58:10 +12:00
|
|
|
|
public ScreencastOptions Options = new ScreencastOptions();
|
|
|
|
|
public string DefaultToolsPath;
|
2014-05-09 15:14:53 +12:00
|
|
|
|
|
2014-07-03 20:33:24 +12:00
|
|
|
|
private bool settingsLoaded;
|
|
|
|
|
|
2014-05-13 20:57:05 +12:00
|
|
|
|
public FFmpegOptionsForm(ScreencastOptions options)
|
2014-05-09 15:14:53 +12:00
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2014-05-13 20:44:35 +12:00
|
|
|
|
Icon = ShareXResources.Icon;
|
2014-05-10 13:52:09 +12:00
|
|
|
|
Options = options;
|
2014-06-08 16:07:55 +12:00
|
|
|
|
eiFFmpeg.ObjectType = typeof(FFmpegOptions);
|
|
|
|
|
cboVideoCodec.Items.AddRange(Helpers.GetEnumDescriptions<FFmpegVideoCodec>());
|
|
|
|
|
cboAudioCodec.Items.AddRange(Helpers.GetEnumDescriptions<FFmpegAudioCodec>());
|
|
|
|
|
cbPreset.Items.AddRange(Helpers.GetEnumDescriptions<FFmpegPreset>());
|
2014-05-10 13:52:09 +12:00
|
|
|
|
|
2014-07-03 20:33:24 +12:00
|
|
|
|
SettingsLoad();
|
2014-05-09 15:14:53 +12:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-12 13:13:42 +12:00
|
|
|
|
private void SettingsLoad()
|
2014-05-09 15:14:53 +12:00
|
|
|
|
{
|
2014-07-03 20:33:24 +12:00
|
|
|
|
settingsLoaded = false;
|
|
|
|
|
|
2014-05-12 13:13:42 +12:00
|
|
|
|
// General
|
2014-05-13 20:44:35 +12:00
|
|
|
|
RefreshSourcesAsync();
|
2014-06-08 16:07:55 +12:00
|
|
|
|
|
2014-05-13 17:55:03 +12:00
|
|
|
|
cboVideoCodec.SelectedIndex = (int)Options.FFmpeg.VideoCodec;
|
2014-05-13 20:44:35 +12:00
|
|
|
|
cboAudioCodec.SelectedIndex = (int)Options.FFmpeg.AudioCodec;
|
2014-05-21 04:28:40 +12:00
|
|
|
|
cbShowError.Checked = Options.FFmpeg.ShowError;
|
2014-05-09 20:12:44 +12:00
|
|
|
|
|
2014-05-10 12:23:47 +12:00
|
|
|
|
string cli = "ffmpeg.exe";
|
2014-05-09 23:45:10 +12:00
|
|
|
|
if (string.IsNullOrEmpty(Options.FFmpeg.CLIPath) && File.Exists(cli))
|
2014-05-10 12:23:47 +12:00
|
|
|
|
{
|
2014-05-09 23:45:10 +12:00
|
|
|
|
Options.FFmpeg.CLIPath = cli;
|
2014-05-10 12:23:47 +12:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-14 11:48:16 +12:00
|
|
|
|
txtFFmpegPath.Text = Options.FFmpeg.CLIPath;
|
2014-05-13 20:44:35 +12:00
|
|
|
|
|
|
|
|
|
tbUserArgs.Text = Options.FFmpeg.UserArgs;
|
2014-05-12 13:13:42 +12:00
|
|
|
|
|
|
|
|
|
// x264
|
2014-05-13 23:50:31 +12:00
|
|
|
|
nudx264CRF.Value = Options.FFmpeg.x264_CRF.Between((int)nudx264CRF.Minimum, (int)nudx264CRF.Maximum);
|
2014-05-12 13:13:42 +12:00
|
|
|
|
cbPreset.SelectedIndex = (int)Options.FFmpeg.Preset;
|
|
|
|
|
|
|
|
|
|
// VPx
|
2014-05-13 23:50:31 +12:00
|
|
|
|
nudVPxCRF.Value = Options.FFmpeg.VPx_CRF.Between((int)nudVPxCRF.Minimum, (int)nudVPxCRF.Maximum);
|
2014-05-12 13:13:42 +12:00
|
|
|
|
|
2014-05-30 19:41:32 +12:00
|
|
|
|
// Xvid
|
2014-05-15 00:24:36 +12:00
|
|
|
|
nudQscale.Value = Options.FFmpeg.XviD_qscale.Between((int)nudQscale.Minimum, (int)nudQscale.Maximum);
|
2014-05-13 23:50:31 +12:00
|
|
|
|
|
2014-05-15 18:13:49 +12:00
|
|
|
|
// AAC
|
|
|
|
|
tbAACBitrate.Value = Options.FFmpeg.AAC_bitrate / 32;
|
|
|
|
|
|
|
|
|
|
// Vorbis
|
2014-05-13 23:50:31 +12:00
|
|
|
|
tbVorbis_qscale.Value = Options.FFmpeg.Vorbis_qscale;
|
|
|
|
|
|
2014-05-15 18:13:49 +12:00
|
|
|
|
// MP3
|
2014-07-03 20:33:24 +12:00
|
|
|
|
tbMP3_qscale.Value = FFmpegHelper.libmp3lame_qscale_end - Options.FFmpeg.MP3_qscale;
|
|
|
|
|
|
|
|
|
|
txtExtension.Text = Options.FFmpeg.Extension;
|
2014-06-04 11:18:41 +12:00
|
|
|
|
|
|
|
|
|
cbCustomCommands.Checked = Options.FFmpeg.UseCustomCommands;
|
|
|
|
|
|
2014-06-08 07:29:26 +12:00
|
|
|
|
if (Options.FFmpeg.UseCustomCommands)
|
|
|
|
|
{
|
|
|
|
|
txtCommandLinePreview.Text = Options.FFmpeg.CustomCommands;
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-03 20:33:24 +12:00
|
|
|
|
settingsLoaded = true;
|
|
|
|
|
|
2014-06-08 07:29:26 +12:00
|
|
|
|
UpdateUI();
|
2014-05-09 15:14:53 +12:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-13 20:44:35 +12:00
|
|
|
|
private void RefreshSourcesAsync()
|
2014-05-13 18:57:09 +12:00
|
|
|
|
{
|
2014-05-13 20:44:35 +12:00
|
|
|
|
btnRefreshSources.Enabled = false;
|
2014-05-13 18:57:09 +12:00
|
|
|
|
DirectShowDevices devices = null;
|
2014-05-22 13:48:27 +12:00
|
|
|
|
|
2014-05-24 03:39:14 +12:00
|
|
|
|
TaskEx.Run(() =>
|
2014-05-13 18:57:09 +12:00
|
|
|
|
{
|
|
|
|
|
using (FFmpegHelper ffmpeg = new FFmpegHelper(Options))
|
|
|
|
|
{
|
|
|
|
|
devices = ffmpeg.GetDirectShowDevices();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
() =>
|
|
|
|
|
{
|
|
|
|
|
cboVideoSource.Items.Clear();
|
2014-08-29 20:22:51 +12:00
|
|
|
|
cboVideoSource.Items.Add(FFmpegHelper.SourceNone);
|
|
|
|
|
cboVideoSource.Items.Add(FFmpegHelper.SourceGDIGrab);
|
2014-05-13 18:57:09 +12:00
|
|
|
|
cboAudioSource.Items.Clear();
|
2014-08-29 20:22:51 +12:00
|
|
|
|
cboAudioSource.Items.Add(FFmpegHelper.SourceNone);
|
2014-05-13 18:57:09 +12:00
|
|
|
|
if (devices != null)
|
|
|
|
|
{
|
|
|
|
|
cboVideoSource.Items.AddRange(devices.VideoDevices.ToArray());
|
|
|
|
|
cboAudioSource.Items.AddRange(devices.AudioDevices.ToArray());
|
|
|
|
|
}
|
2014-05-13 20:44:35 +12:00
|
|
|
|
cboVideoSource.Text = Options.FFmpeg.VideoSource;
|
|
|
|
|
cboAudioSource.Text = Options.FFmpeg.AudioSource;
|
|
|
|
|
btnRefreshSources.Enabled = true;
|
2014-05-13 18:57:09 +12:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-03 20:33:24 +12:00
|
|
|
|
private void UpdateUI()
|
2014-05-12 20:40:56 +12:00
|
|
|
|
{
|
2014-07-03 20:33:24 +12:00
|
|
|
|
if (settingsLoaded)
|
2014-05-12 11:19:38 +12:00
|
|
|
|
{
|
2014-10-18 00:08:33 +13:00
|
|
|
|
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;
|
2014-05-09 23:45:10 +12:00
|
|
|
|
|
2014-07-03 20:33:24 +12:00
|
|
|
|
if (!Options.FFmpeg.UseCustomCommands)
|
|
|
|
|
{
|
|
|
|
|
txtCommandLinePreview.Text = Options.GetFFmpegArgs();
|
|
|
|
|
}
|
2014-05-15 18:13:49 +12:00
|
|
|
|
}
|
2014-05-14 23:18:18 +12:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-13 20:44:35 +12:00
|
|
|
|
private void btnRefreshSources_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
RefreshSourcesAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cboVideoSource_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Options.FFmpeg.VideoSource = cboVideoSource.Text;
|
2014-06-04 11:18:41 +12:00
|
|
|
|
UpdateUI();
|
2014-05-13 20:44:35 +12:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cboAudioSource_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Options.FFmpeg.AudioSource = cboAudioSource.Text;
|
2014-06-04 11:18:41 +12:00
|
|
|
|
UpdateUI();
|
2014-05-13 20:44:35 +12:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cboVideoCodec_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Options.FFmpeg.VideoCodec = (FFmpegVideoCodec)cboVideoCodec.SelectedIndex;
|
2014-07-03 20:33:24 +12:00
|
|
|
|
|
|
|
|
|
if (settingsLoaded)
|
|
|
|
|
{
|
|
|
|
|
switch (Options.FFmpeg.VideoCodec)
|
|
|
|
|
{
|
|
|
|
|
case FFmpegVideoCodec.libx264:
|
|
|
|
|
txtExtension.Text = "mp4";
|
|
|
|
|
break;
|
|
|
|
|
case FFmpegVideoCodec.libvpx:
|
|
|
|
|
txtExtension.Text = "webm";
|
|
|
|
|
break;
|
|
|
|
|
case FFmpegVideoCodec.libxvid:
|
|
|
|
|
txtExtension.Text = "avi";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (cboVideoCodec.SelectedIndex >= 0)
|
|
|
|
|
{
|
|
|
|
|
tcFFmpegVideoCodecs.SelectedIndex = cboVideoCodec.SelectedIndex;
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-04 11:18:41 +12:00
|
|
|
|
UpdateUI();
|
2014-05-13 20:44:35 +12:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cboAudioCodec_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Options.FFmpeg.AudioCodec = (FFmpegAudioCodec)cboAudioCodec.SelectedIndex;
|
2014-07-03 20:33:24 +12:00
|
|
|
|
|
|
|
|
|
if (cboAudioCodec.SelectedIndex >= 0)
|
|
|
|
|
{
|
|
|
|
|
tcFFmpegAudioCodecs.SelectedIndex = cboAudioCodec.SelectedIndex;
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-04 11:18:41 +12:00
|
|
|
|
UpdateUI();
|
2014-05-13 20:44:35 +12:00
|
|
|
|
}
|
|
|
|
|
|
2014-07-03 20:33:24 +12:00
|
|
|
|
private void txtExtension_TextChanged(object sender, EventArgs e)
|
2014-05-13 20:44:35 +12:00
|
|
|
|
{
|
2014-07-03 20:33:24 +12:00
|
|
|
|
Options.FFmpeg.Extension = txtExtension.Text;
|
2014-06-04 11:18:41 +12:00
|
|
|
|
UpdateUI();
|
2014-05-13 20:44:35 +12:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void nudx264CRF_ValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-05-13 23:50:31 +12:00
|
|
|
|
Options.FFmpeg.x264_CRF = (int)nudx264CRF.Value;
|
2014-06-04 11:18:41 +12:00
|
|
|
|
UpdateUI();
|
2014-05-13 20:44:35 +12:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cbPreset_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Options.FFmpeg.Preset = (FFmpegPreset)cbPreset.SelectedIndex;
|
2014-06-04 11:18:41 +12:00
|
|
|
|
UpdateUI();
|
2014-05-13 20:44:35 +12:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void nudVPxCRF_ValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-05-13 23:50:31 +12:00
|
|
|
|
Options.FFmpeg.VPx_CRF = (int)nudVPxCRF.Value;
|
2014-06-04 11:18:41 +12:00
|
|
|
|
UpdateUI();
|
2014-05-13 20:44:35 +12:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void nudQscale_ValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-05-15 00:24:36 +12:00
|
|
|
|
Options.FFmpeg.XviD_qscale = (int)nudQscale.Value;
|
2014-06-04 11:18:41 +12:00
|
|
|
|
UpdateUI();
|
2014-05-13 20:44:35 +12:00
|
|
|
|
}
|
|
|
|
|
|
2014-07-03 20:33:24 +12:00
|
|
|
|
private void tbAACBitrate_ValueChanged(object sender, EventArgs e)
|
2014-05-15 18:13:49 +12:00
|
|
|
|
{
|
|
|
|
|
Options.FFmpeg.AAC_bitrate = tbAACBitrate.Value * 32;
|
|
|
|
|
UpdateUI();
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-03 20:33:24 +12:00
|
|
|
|
private void tbVorbis_qscale_ValueChanged(object sender, EventArgs e)
|
2014-05-15 18:13:49 +12:00
|
|
|
|
{
|
|
|
|
|
Options.FFmpeg.Vorbis_qscale = tbVorbis_qscale.Value;
|
|
|
|
|
UpdateUI();
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-03 20:33:24 +12:00
|
|
|
|
private void tbMP3_qscale_ValueChanged(object sender, EventArgs e)
|
2014-05-15 18:13:49 +12:00
|
|
|
|
{
|
2014-07-03 20:33:24 +12:00
|
|
|
|
Options.FFmpeg.MP3_qscale = FFmpegHelper.libmp3lame_qscale_end - tbMP3_qscale.Value;
|
2014-05-15 18:13:49 +12:00
|
|
|
|
UpdateUI();
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-21 04:28:40 +12:00
|
|
|
|
private void cbShowError_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Options.FFmpeg.ShowError = cbShowError.Checked;
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-13 20:44:35 +12:00
|
|
|
|
private void tbFFmpegPath_TextChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-05-14 11:48:16 +12:00
|
|
|
|
Options.FFmpeg.CLIPath = txtFFmpegPath.Text;
|
2014-05-14 23:18:18 +12:00
|
|
|
|
txtFFmpegPath.BackColor = File.Exists(txtFFmpegPath.Text) ? Color.FromArgb(200, 255, 200) : Color.FromArgb(255, 200, 200);
|
2014-05-13 20:44:35 +12:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-09 20:12:44 +12:00
|
|
|
|
private void buttonFFmpegBrowse_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-10-18 00:08:33 +13:00
|
|
|
|
if (Helpers.BrowseFile(Resources.FFmpegOptionsForm_buttonFFmpegBrowse_Click_Browse_for_ffmpeg_exe, txtFFmpegPath, Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)))
|
2014-05-13 18:57:09 +12:00
|
|
|
|
{
|
2014-05-13 20:44:35 +12:00
|
|
|
|
RefreshSourcesAsync();
|
2014-05-13 18:57:09 +12:00
|
|
|
|
}
|
2014-05-09 23:45:10 +12:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-13 20:44:35 +12:00
|
|
|
|
private void tbUserArgs_TextChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Options.FFmpeg.UserArgs = tbUserArgs.Text;
|
2014-06-04 11:18:41 +12:00
|
|
|
|
UpdateUI();
|
2014-05-13 20:44:35 +12:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-09 23:45:10 +12:00
|
|
|
|
private void buttonFFmpegHelp_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-07-03 20:33:24 +12:00
|
|
|
|
URLHelpers.OpenURL("https://github.com/ShareX/ShareX/wiki/FFmpeg-options#additional-commands");
|
2014-05-09 20:12:44 +12:00
|
|
|
|
}
|
2014-05-10 12:23:47 +12:00
|
|
|
|
|
|
|
|
|
private void btnDownload_Click(object sender, EventArgs e)
|
2014-05-10 13:52:09 +12:00
|
|
|
|
{
|
2014-05-12 10:58:10 +12:00
|
|
|
|
FFmpegHelper.DownloadFFmpeg(true, DownloaderForm_InstallRequested);
|
2014-05-10 13:52:09 +12:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-12 10:58:10 +12:00
|
|
|
|
private void DownloaderForm_InstallRequested(string filePath)
|
2014-05-10 12:23:47 +12:00
|
|
|
|
{
|
2014-05-12 11:19:38 +12:00
|
|
|
|
string extractPath = DefaultToolsPath ?? "ffmpeg.exe";
|
|
|
|
|
bool result = FFmpegHelper.ExtractFFmpeg(filePath, extractPath);
|
2014-05-10 12:23:47 +12:00
|
|
|
|
|
|
|
|
|
if (result)
|
|
|
|
|
{
|
2014-05-13 18:57:09 +12:00
|
|
|
|
this.InvokeSafe(() =>
|
|
|
|
|
{
|
2014-05-14 11:48:16 +12:00
|
|
|
|
txtFFmpegPath.Text = extractPath;
|
2014-05-13 20:44:35 +12:00
|
|
|
|
RefreshSourcesAsync();
|
2014-05-15 18:13:49 +12:00
|
|
|
|
UpdateUI();
|
2014-05-13 18:57:09 +12:00
|
|
|
|
});
|
2014-06-05 02:08:07 +12:00
|
|
|
|
|
2014-10-18 01:19:28 +13:00
|
|
|
|
MessageBox.Show(Resources.FFmpegOptionsForm_DownloaderForm_InstallRequested_Successfully_downloaded_FFmpeg_, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
2014-05-10 12:23:47 +12:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-10-18 01:19:28 +13:00
|
|
|
|
MessageBox.Show(Resources.FFmpegOptionsForm_DownloaderForm_InstallRequested_Download_of_FFmpeg_failed_, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
2014-05-10 12:23:47 +12:00
|
|
|
|
}
|
|
|
|
|
}
|
2014-05-12 22:56:37 +12:00
|
|
|
|
|
|
|
|
|
private void btnTest_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (File.Exists(Options.FFmpeg.CLIPath))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
using (Process process = new Process())
|
|
|
|
|
{
|
2014-05-12 23:15:17 +12:00
|
|
|
|
ProcessStartInfo psi = new ProcessStartInfo("cmd.exe");
|
2014-06-04 11:18:41 +12:00
|
|
|
|
psi.Arguments = "/k ffmpeg " + Options.GetFFmpegCommands();
|
2014-05-12 22:56:37 +12:00
|
|
|
|
psi.WorkingDirectory = Path.GetDirectoryName(Options.FFmpeg.CLIPath);
|
|
|
|
|
|
|
|
|
|
process.StartInfo = psi;
|
|
|
|
|
process.Start();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
DebugHelper.WriteException(ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnCopyPreview_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-06-04 11:18:41 +12:00
|
|
|
|
ClipboardHelpers.CopyText("ffmpeg " + Options.GetFFmpegCommands());
|
2014-05-13 18:57:09 +12:00
|
|
|
|
}
|
2014-05-30 19:41:32 +12:00
|
|
|
|
|
2014-06-04 11:18:41 +12:00
|
|
|
|
private void cbCustomCommands_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Options.FFmpeg.UseCustomCommands = cbCustomCommands.Checked;
|
|
|
|
|
txtCommandLinePreview.ReadOnly = !Options.FFmpeg.UseCustomCommands;
|
|
|
|
|
|
2014-07-19 22:14:53 +12:00
|
|
|
|
if (settingsLoaded)
|
2014-06-04 23:55:25 +12:00
|
|
|
|
{
|
2014-07-19 22:14:53 +12:00
|
|
|
|
if (Options.FFmpeg.UseCustomCommands)
|
|
|
|
|
{
|
|
|
|
|
txtCommandLinePreview.Text = Options.GetFFmpegArgs(true);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
txtCommandLinePreview.Text = Options.GetFFmpegArgs();
|
|
|
|
|
}
|
2014-06-04 23:55:25 +12:00
|
|
|
|
}
|
2014-06-04 11:18:41 +12:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void txtCommandLinePreview_TextChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-06-04 23:55:25 +12:00
|
|
|
|
Options.FFmpeg.CustomCommands = txtCommandLinePreview.Text;
|
2014-06-04 11:18:41 +12:00
|
|
|
|
}
|
2014-06-08 08:19:31 +12:00
|
|
|
|
|
|
|
|
|
private void btnHelp_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-07-03 06:19:51 +12:00
|
|
|
|
URLHelpers.OpenURL("https://github.com/ShareX/ShareX/wiki/FFmpeg-options");
|
2014-06-08 08:19:31 +12:00
|
|
|
|
}
|
2014-06-08 16:07:55 +12:00
|
|
|
|
|
|
|
|
|
private object eiFFmpeg_ExportRequested()
|
|
|
|
|
{
|
|
|
|
|
return Options.FFmpeg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void eiFFmpeg_ImportRequested(object obj)
|
|
|
|
|
{
|
|
|
|
|
FFmpegOptions ffmpegOptions = obj as FFmpegOptions;
|
|
|
|
|
|
|
|
|
|
if (ffmpegOptions != null)
|
|
|
|
|
{
|
|
|
|
|
string tempFFmpegPath = Options.FFmpeg.CLIPath;
|
|
|
|
|
Options.FFmpeg = ffmpegOptions;
|
|
|
|
|
Options.FFmpeg.CLIPath = tempFFmpegPath;
|
|
|
|
|
SettingsLoad();
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-05-09 15:14:53 +12:00
|
|
|
|
}
|
|
|
|
|
}
|