Animated Gif with Opencv

Hello, How to create an Gif animated image from 2 cv::Mat OpenCV flipping one to another ?
Thank you,

sorry, but there is nothing builtin to do that here.
(it neither reads nor writes gif)

save your animation as an image list, then use some external tool to write a gif from it.

tell VideoWriter to make a .gif file. it hopefully picks ffmpeg for a backend, and ffmpeg can do .gif files. I have no idea what the fourcc argument would need to be.