Rendering GIFs
Available since v3.1
You can render a video as a GIF by:
- passing
--codec=gif
in 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,
everyNthFrame
is set to1
: Frames0
,1
,2
,3
,4
and so on are rendered. - Assuming
everyNthFrame
is2
, only every 2nd frame is rendered:1
,3
,5
,7
and so on. A 30FPS video would now become a 15FPS GIF. - If
everyNthFrame
is3
, only every 3rd frame is rendered:2
,5
,8
,11
and the pattern continues.
everyNthFrame
is supported:
- in
renderFrames()
,renderMedia()
andrenderMediaOnLambda()
- in the CLI using
--every-nth-frame=2
locally 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.0
disables looping.1
loops the GIF once (plays twice in total)2
loops 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=0
flag 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.