rename 'our $i; s/_.*/sprintf("_%03d.png", $i++)/e' *.png
This command assumes the file name followes something like image_001.png or IMG_001.png etc...
It will then change the numbers at the end to start from 001 to however many images there are without skipping a number
(Be sure to update the %03d in the middle for however many images you have, the 3 represents how many digits are in the number)
ffmpeg -framerate 30/1 -i IMG_%03d.png -c:v libx265 -vf "fps=30,format=yuv420p" timelapse.mp4
the format of -framerate is frames/second, for example 30 frames a second is 30/1, or one frame every three seconds is 1/3
-i is the input file, or in this case the images, change this to suit the image naming convention you are using, the %03d should match the previous command
-c:v libx265 is the video encoding to use, libx264 is more common
-vf "fps=30,format=yuv420p" is how the output video will be encoded, this example will be 30 frames a second using the yuv420p format, which is commonly supported
timelapse.mp4 is the output file, change it to .gif if you want an animated gif