Slow ffmpeg 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. For this I use ffmpeg. ffmpeg -f image2 -i screenshot_%5d.png -vcodec mpeg4 demo.avi . However, the length of the video is shorter than I want, and it moves very fast. How to specify how many images per second I want? I tried the -r argument, but that didn't work.

+6
source share
2 answers

You can change the speed of the video by setting the "presentation time stamp" (PTS). In your case:

 ffmpeg -f image2 -i screenshot_%5d.png -vcodec mpeg4 -vf "setpts=5*PTS" demo.avi 

You will get a video that plays 5 times slower than a regular video.

If you want to do it 5 times faster:

 ffmpeg -f image2 -i screenshot_%5d.png -vcodec mpeg4 -vf "setpts=(1/5)*PTS" demo.avi 
+7
source

You need to specify capture speed

  # 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 
0
source

Source: https://habr.com/ru/post/913697/


All Articles