Q:

slow ffmpeg's images per second when creating video from images

I have a series of screenshots from a demo that I want to put in a video. I am using ffmpeg for this purpose. The command is ffmpeg -f image2 -i screenshot_%5d.png -vcodec mpeg4 demo.avi. However, the video length is shorter than what I want, and it moves very fast. How do I specify how many images per second I want? I tried the -r argument but that did not work.

A:

You can change video speed by adjusting the “presentation time stamp” (PTS).
In your case:
ffmpeg -f image2 -i screenshot_%5d.png -vcodec mpeg4  -vf "setpts=5*PTS" demo.avi

You'll get video, which plays 5 times slower, than normal video.
If you want to make it 5 times faster:
ffmpeg -f image2 -i screenshot_%5d.png -vcodec mpeg4  -vf "setpts=(1/5)*PTS" demo.avi

