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.
Asked
Active
Viewed 5,586 times
10

apoorv020
- 5,420
- 11
- 40
- 63
-
Can you show where you put the -r option? The rate can apply both to the input rate and output rate. See examples at: http://ffmpeg.org/ffmpeg.html#toc-Description – Roger Lindsjö Apr 20 '12 at 07:03
-
@RogerLindsjö : Thanks for pointing that out. I was specifying the -r just before the output. Trying it before the input file worked. Please go ahead and post an answer if you wish, otherwise I will do it after some time. – apoorv020 Apr 20 '12 at 08:10
2 Answers
14
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

Alexey
- 662
- 6
- 11
0
You need to specify the capture rate
# Note: The frame rate (-r) can be an integer or a float
ffmpeg -r 23.976 \
-f image2 \
-i test-%06d.png \
-vcodec mpeg4 \
test.avi

Peter.O
- 6,696
- 4
- 30
- 37