This snippet demonstrates how to convert videos to GIFs with a minimal loss of quality. This is for reference and can be used in any shortcut.
Full disclosure: I did not come up with this method by myself. I saw a similar technique in an early version of DTwitter by @heismauri (https://routinehub.co/shortcut/6166) and adapted it to handle videos from the Photos app instead of Twitter. I have shared this snippet quite frequently, so I’ve published it on RoutineHub to avoid creating more iCloud links for the same shortcut.