Reputation: 109
I want to create a gif image from a jpeg image list, everything works fine, but how can I slow the animation?
Here is my code:
<?php
exec('ffmpeg -f image2 -i thumb/%001d.jpg -vf scale=480x240 out.gif');
?>
Upvotes: 9
Views: 13679
Reputation: 93329
To slow down an image sequence, lower its framerate
ffmpeg -f image2 -framerate 10 -i thumb/%001d.jpg -vf scale=480x240 out.gif
Upvotes: 7
Reputation: 6145
You want the -r
flag to set the frame rate (in frames per second). From the official documentation:
-r[:stream_specifier] fps (input/output,per-stream)
Set frame rate (Hz value, fraction or abbreviation).
As an input option, ignore any timestamps stored in the file and instead generate timestamps assuming constant frame rate fps. This is not the same as the -framerate option used for some input formats like image2 or v4l2 (it used to be the same in older versions of FFmpeg). If in doubt use -framerate instead of the input option -r.
As an output option, duplicate or drop input frames to achieve constant output frame rate fps.
For example, setting to 30 fps:
ffmpeg -f image2 -i thumb/%001d.jpg -vf scale=480x240 -r 30 out.gif
Note: The -r
argument must appear after the input file if you want it to apply to the output
Upvotes: 0