Explanation:
split
: This duplicates the GIF stream.trim
: Cuts the frames at specific points (start_frame=X
andend_frame=N
where X is the frame you want to start with, and N is the total number of frames).concat
: Combines the two parts back together so the loop remains seamless.setpts=PTS-STARTPTS
: Adjusts the presentation timestamps so the frames play sequentially.