Rendering GIFs
Available since v3.1
You can render a video as a GIF by:
- passing
--codec=gifin the command line - setting
codec: "gif"inrenderMedia(),stitchFramesToVideo()orrenderMediaOnLambda().
Reducing frame rate
Commonly a GIF has a lower frame rate than a video. For this, we support a parameter everyNthFrame that works as follows:
- By default,
everyNthFrameis set to1: Frames0,1,2,3,4and so on are rendered. - Assuming
everyNthFrameis2, only every 2nd frame is rendered:1,3,5,7and so on. A 30FPS video would now become a 15FPS GIF. - If
everyNthFrameis3, only every 3rd frame is rendered:2,5,8,11and the pattern continues.
everyNthFrame is supported:
- in
renderFrames(),renderMedia()andrenderMediaOnLambda() - in the CLI using
--every-nth-frame=2locally or on Lambda. - in the config file using
setEveryNthFrame().
Changing the number of loops
The numberOfGifLoops option allows you to set the number of loops as follows:
null(or omitting in the CLI) means to play the GIF indefinitely.0disables looping.1loops the GIF once (plays twice in total)2loops the GIF twice (plays three times in total)- and so on.
The numberOfGifLoops option can be set:
- In the CLI using the
--number-of-gif-loops=0flag when rendering locally or on Lambda. - in
stitchFramesToVideo(),renderMedia()andrenderMediaOnLambda() - in the config file using
setNumberOfGifLoops().
Importing GIFs
Wondering how to import other GIFs into a Remotion project? See here.
Transparent GIFs
To render a transparent GIF, the imageFormat option must be set to "png". In the Remotion Studio, this can be set in the "Picture" tab.