From b0f90358505aa606a1bd7bfdb0e53df1cc659928 Mon Sep 17 00:00:00 2001 From: Tim Bond Date: Sat, 1 Nov 2025 15:18:09 -0700 Subject: [PATCH] Use mpdecimate ffmpeg video filter for encoding GIFs When there is no activity in a GIF there is still a new frame generated every 1/framerate seconds. At the default recording of 15 FPS this means that a new frame is generated and stored in the file every 6/100 or 7/100 of a second. If nothing changed between the two frames, it is more efficient to extend the duration of the first frame and drop the second. This is what ffmpeg's mpdecimate filter does. For more info see https://trembit.com/blog/ffmpeg-mpdecimate-filter-for-dummies/ --- ShareX.ScreenCaptureLib/ScreenRecording/ScreenRecorder.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ShareX.ScreenCaptureLib/ScreenRecording/ScreenRecorder.cs b/ShareX.ScreenCaptureLib/ScreenRecording/ScreenRecorder.cs index 97021c653..0bb6ce771 100644 --- a/ShareX.ScreenCaptureLib/ScreenRecording/ScreenRecorder.cs +++ b/ShareX.ScreenCaptureLib/ScreenRecording/ScreenRecorder.cs @@ -283,6 +283,9 @@ namespace ShareX.ScreenCaptureLib args.Append(":new=1"); } + // https://ffmpeg.org/ffmpeg-filters.html#mpdecimate + args.Append(",mpdecimate"); + args.Append("\" "); args.Append("-y "); args.Append($"\"{output}\""); @@ -324,4 +327,4 @@ namespace ShareX.ScreenCaptureLib } } } -} \ No newline at end of file +}