mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 17:56:51 +13:00
commit
37123fa25c
7 changed files with 3085 additions and 1048 deletions
|
@ -101,39 +101,13 @@ public bool EncodeVideo(string input, string output)
|
|||
return Run(Options.FFmpeg.FFmpegPath, Options.GetFFmpegCommands());
|
||||
}
|
||||
|
||||
public bool EncodeGIF(string input, string output, string tempFolder)
|
||||
{
|
||||
bool result;
|
||||
|
||||
string palettePath = Path.Combine(tempFolder, "FFmpeg-palette.png");
|
||||
|
||||
try
|
||||
public bool EncodeGIF(string input, string output)
|
||||
{
|
||||
// https://ffmpeg.org/ffmpeg-filters.html#palettegen-1
|
||||
result = Run(Options.FFmpeg.FFmpegPath, string.Format("-y -i \"{0}\" -vf \"palettegen=stats_mode={2}\" \"{1}\"", input, palettePath, Options.FFmpeg.GIFStatsMode));
|
||||
|
||||
if (result)
|
||||
{
|
||||
if (File.Exists(palettePath))
|
||||
{
|
||||
// https://ffmpeg.org/ffmpeg-filters.html#paletteuse
|
||||
result = Run(Options.FFmpeg.FFmpegPath, string.Format("-y -i \"{0}\" -i \"{1}\" -lavfi \"paletteuse=dither={3}\" \"{2}\"", input, palettePath, output, Options.FFmpeg.GIFDither));
|
||||
}
|
||||
else
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (File.Exists(palettePath))
|
||||
{
|
||||
File.Delete(palettePath);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return Run(Options.FFmpeg.FFmpegPath,
|
||||
$"-y -i \"{input}\" -lavfi \"palettegen=stats_mode={Options.FFmpeg.GIFStatsMode}[palette]," +
|
||||
$"[0:v][palette]paletteuse=dither={Options.FFmpeg.GIFDither}\" \"{output}\"");
|
||||
}
|
||||
|
||||
private bool Run(string path, string args = null)
|
||||
|
|
|
@ -233,16 +233,13 @@ public void SaveAsGIF(string path, GIFQuality quality)
|
|||
public bool FFmpegEncodeVideo(string input, string output)
|
||||
{
|
||||
Helpers.CreateDirectoryFromFilePath(output);
|
||||
bool result = ffmpegCli.EncodeVideo(input, output);
|
||||
//DebugHelper.WriteLine("Video encoding result:\nInput file size: {0}\nOutput file size: {1}", new FileInfo(input).Length.ToSizeString(), new FileInfo(output).Length.ToSizeString());
|
||||
return result;
|
||||
return ffmpegCli.EncodeVideo(input, output);
|
||||
}
|
||||
|
||||
public bool FFmpegEncodeAsGIF(string sourceFilePath, string targetFilePath, string tempFolder)
|
||||
public bool FFmpegEncodeAsGIF(string input, string output)
|
||||
{
|
||||
Helpers.CreateDirectoryFromFilePath(targetFilePath);
|
||||
Helpers.CreateDirectoryFromDirectoryPath(tempFolder);
|
||||
return ffmpegCli.EncodeGIF(sourceFilePath, targetFilePath, tempFolder);
|
||||
Helpers.CreateDirectoryFromFilePath(output);
|
||||
return ffmpegCli.EncodeGIF(input, output);
|
||||
}
|
||||
|
||||
protected void OnRecordingStarted()
|
||||
|
|
|
@ -591,10 +591,6 @@ private void form_KeyDown(object sender, KeyEventArgs e)
|
|||
case Keys.PageDown:
|
||||
MoveCurrentShapeDown();
|
||||
break;
|
||||
case Keys.Q:
|
||||
Options.QuickCrop = !Options.QuickCrop;
|
||||
tsmiQuickCrop.Checked = !Options.QuickCrop;
|
||||
break;
|
||||
case Keys.M:
|
||||
CurrentTool = ShapeType.ToolSelect;
|
||||
break;
|
||||
|
@ -625,6 +621,16 @@ private void form_KeyDown(object sender, KeyEventArgs e)
|
|||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (e.KeyData)
|
||||
{
|
||||
case Keys.Q:
|
||||
Options.QuickCrop = !Options.QuickCrop;
|
||||
tsmiQuickCrop.Checked = !Options.QuickCrop;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int speed;
|
||||
|
|
|
@ -213,6 +213,12 @@ public override UploadResult Upload(Stream stream, string fileName)
|
|||
DebugHelper.WriteLine("B2 uploader: Too Many Requests, trying with same URL.");
|
||||
continue;
|
||||
}
|
||||
else if (uploadResult.RC == 503)
|
||||
{
|
||||
DebugHelper.WriteLine("B2 uploader: Service Unavailable, trying with new URL.");
|
||||
url = null;
|
||||
continue;
|
||||
}
|
||||
else if (uploadResult.RC != 200)
|
||||
{
|
||||
// something else happened that wasn't a success, so bail out
|
||||
|
|
11
ShareX/Forms/TaskSettingsForm.Designer.cs
generated
11
ShareX/Forms/TaskSettingsForm.Designer.cs
generated
|
@ -247,6 +247,7 @@ private void InitializeComponent()
|
|||
this.pgTaskSettings = new System.Windows.Forms.PropertyGrid();
|
||||
this.chkOverrideAdvancedSettings = new System.Windows.Forms.CheckBox();
|
||||
this.tttvMain = new ShareX.HelpersLib.TabToTreeView();
|
||||
this.lblActionsNote = new System.Windows.Forms.Label();
|
||||
this.tcTaskSettings.SuspendLayout();
|
||||
this.tpTask.SuspendLayout();
|
||||
this.cmsDestinations.SuspendLayout();
|
||||
|
@ -1895,6 +1896,7 @@ private void InitializeComponent()
|
|||
//
|
||||
// pActions
|
||||
//
|
||||
this.pActions.Controls.Add(this.lblActionsNote);
|
||||
this.pActions.Controls.Add(this.btnActionsDuplicate);
|
||||
this.pActions.Controls.Add(this.btnActionsAdd);
|
||||
this.pActions.Controls.Add(this.lvActions);
|
||||
|
@ -1930,6 +1932,7 @@ private void InitializeComponent()
|
|||
this.chActionsArgs,
|
||||
this.chActionsExtensions});
|
||||
this.lvActions.FullRowSelect = true;
|
||||
this.lvActions.HideSelection = false;
|
||||
this.lvActions.MultiSelect = false;
|
||||
this.lvActions.Name = "lvActions";
|
||||
this.lvActions.UseCompatibleStateImageBehavior = false;
|
||||
|
@ -2010,6 +2013,7 @@ private void InitializeComponent()
|
|||
this.chWatchFolderFilter,
|
||||
this.chWatchFolderIncludeSubdirectories});
|
||||
this.lvWatchFolderList.FullRowSelect = true;
|
||||
this.lvWatchFolderList.HideSelection = false;
|
||||
this.lvWatchFolderList.Name = "lvWatchFolderList";
|
||||
this.lvWatchFolderList.UseCompatibleStateImageBehavior = false;
|
||||
this.lvWatchFolderList.View = System.Windows.Forms.View.Details;
|
||||
|
@ -2110,6 +2114,11 @@ private void InitializeComponent()
|
|||
this.tttvMain.TreeViewSize = 190;
|
||||
this.tttvMain.TabChanged += new ShareX.HelpersLib.TabToTreeView.TabChangedEventHandler(this.tttvMain_TabChanged);
|
||||
//
|
||||
// lblActionsNote
|
||||
//
|
||||
resources.ApplyResources(this.lblActionsNote, "lblActionsNote");
|
||||
this.lblActionsNote.Name = "lblActionsNote";
|
||||
//
|
||||
// TaskSettingsForm
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
|
@ -2188,6 +2197,7 @@ private void InitializeComponent()
|
|||
this.tpActions.ResumeLayout(false);
|
||||
this.tpActions.PerformLayout();
|
||||
this.pActions.ResumeLayout(false);
|
||||
this.pActions.PerformLayout();
|
||||
this.tpWatchFolders.ResumeLayout(false);
|
||||
this.tpWatchFolders.PerformLayout();
|
||||
this.tpTools.ResumeLayout(false);
|
||||
|
@ -2419,5 +2429,6 @@ private void InitializeComponent()
|
|||
private System.Windows.Forms.Label lblAutoIncrementNumber;
|
||||
private System.Windows.Forms.NumericUpDown nudAutoIncrementNumber;
|
||||
private System.Windows.Forms.Button btnAutoIncrementNumber;
|
||||
private System.Windows.Forms.Label lblActionsNote;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -303,7 +303,7 @@ private static string ProcessTwoPassEncoding(string input, TaskSettings taskSett
|
|||
{
|
||||
if (taskSettings.CaptureSettings.FFmpegOptions.VideoCodec == FFmpegVideoCodec.gif)
|
||||
{
|
||||
screenRecorder.FFmpegEncodeAsGIF(input, output, Program.ToolsFolder);
|
||||
screenRecorder.FFmpegEncodeAsGIF(input, output);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue