Creating gif from jpeg images with ffmpeg

I want to create a gif image from a jpeg image list, everything works fine, but how can I slow down the animation?

Here is my code:

<?php
exec('ffmpeg -f image2 -i thumb/%001d.jpg -vf scale=480x240  out.gif');
?>

      

+3


source to share


3 answers


To slow down a sequence of images, lower its frame rate



ffmpeg -f image2 -framerate 10 -i thumb/%001d.jpg -vf scale=480x240  out.gif

      

+2


source


To set the frame rate (in frames per second) you want -r

. From the official documentation:

-r [: stream_specifier] fps (input / output, for stream)

Set the frame rate (value, fraction, or abbreviation).

As an input parameter, ignore any timestamps stored in the file, and instead create timestamps assuming constant fps. This is not the same as the -framerate option used for some input formats such as image2 or v4l2 (it was the same in previous versions of FFmpeg). When in doubt, use -framerate instead of the -r input parameter.

As an output option, duplicate or drop input frames to achieve constant output fps.

For example, setting 30 fps:



ffmpeg -f image2 -i thumb/%001d.jpg -vf scale=480x240 -r 30 out.gif

      

Note. The argument -r

must appear after the input file if you want to apply it to the output

0


source


I am using this code:

<?php
exec('ffmpeg -ss '.$date.' -i video.mp4 -vf scale=320x180 thumb/'.$i.'.png');
?>

      

I am using a loop to generate multiple $ i images in the $ date variable and there are loop numbers and $ date generates the time at which the image to be generated. The problem is that sometimes black images are generated. How to fix it?

0


source







All Articles