Create high quality Steam gifs with gifski

After several attempts to create good looking gifs for my game on Steam, I found Gifski. It is a great FOSS (AGPLv3) tool to create high quality and lightweight gifs.
Note: While writing this blog post, I learned so much that I recreated all my store gifs again. This shows once again that writing a blog can be useful in several unexpected ways.
Creating the base video
Here you can read the official Steam recommendations for store page assets. They suggest a 1170px width in order to maximize quality on high DPI displays. The maximum video duration is 12 seconds and the color space should be set to BT.709.
I register video with OBSStudio. I'm not an OBSStudio power user (yet), therefore I will just give the minimal advice for this post. There are a lot of settings that can influence the final outcome. I also just found out, that depending on your graphics card model, some other settings work better.
I don't have any graphics card, so I simply use a profile with 1080x1920 resolution and 60FPS. That can be set in Controls -> Settings -> Video.
As recording format I use Matroska Video (.mkv) and as video encoder x264. These can be set in Controls -> Settings -> Output -> Recording.
The color space 709 can be set in Controls -> Settings -> Advanced -> Color Space.
I prefer using this settings, because this way I can use the base video also as non-gif. Using the final gif resolution and FPS could also work, but I haven't tested that yet.
Once the registration is done, the video probably needs to be cut. My go to FOSS video editor is Kdenlive. But I have not yet figured out, how to cut videos, without re-encoding and loosing quality. If you happen to know, please write me :-)
For that reason I simply watch the final video and cut it using ffmpeg manually. The following example cuts the video from second 3 to 15, resulting in exact 12 seconds of video.
ffmpeg -copyts -ss 00:03 -i registration.mkv -to 00:15 -map 0 -c copy cut.mkvCreating the gif for Steam
Once the base…