How I Make GIFs From OBS Clips in Windows
Before GitLab and GitHub supported MP4 files natively in pull requests, I used to use Gifox to record demos of new features and bug fixes. Thankfully, they now support video attachments so it's easy enough to record your screen with QuickTime or another tool and simply drag it on over. For platforms that don't support video uploads or infinite looping, GIFs can still be useful.
Turning MKV clips in OBS into GIFs on Windows has been more challenging. My current process is to string three different tools together to both trim the final GIF to the exact length I want and get the file size down to something upload-able to social media.
1. Grab a segment of the MKV with MKVToolNix GUI
Gameplay videos can vary quite a bit in length, so I first start by trimming a video to a segment that the MKV to GIF tool will not completely choke on (less than 30 seconds). You could do this directly with FFMPEG, but I can rarely remember the parameters I need and prefer to use MKVToolNix GUI.
Output > Splitting > Split Mode > By parts based on timestamps
I then provide it the general timestamp range — the example below would grab the first 5 seconds.
2. Convert MKV clip into GIF with GifTuna
With GifTuna I then convert the short MKV clip into a GIF with specified dimensions and FPS. Depending on the length of the clip, I can get away with a higher resolution or higher frame rate. 360p/20fps is typically the lowest I will go for a longer clip.
3. (Optional) Trim GIF and further compress with ScreenToGif
If I want to trim a few frames out of the GIF, or if it is still not under 10MB, I then use ScreenToGif. It has an editor mode that allows you to view and individually delete frames, and a myriad of options for re-encoding. If using ScreenToGif, I'll typically leave the resolution closer to the original video when making the initial GIF with GifTuna.
After uploading to Mastodon (where it gets converted to a looping MP4), the final result looks like this: