Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 496
apoorv020 Avatar asked Apr 20 '12 06:04

apoorv020


People also ask

Why is Ffmpeg so slow?

If your CPU usage is still low after FFmpeg has managed to seek to the defined point in the video, it's likely due to one or more of the filters you're using. Some filters may not be able to use all the available CPU threads, and some filters aren't even multi-threaded.

How do I increase video speed in ffmpeg?

Speeding up/slowing down video This can be done via two methods: using the ​setpts video filter (which requires re-encoding) or by erasing the timestamps by exporting the video to a raw bitstream format and muxing to a container while creating new timestamps.


1 Answers

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
like image 64
Alexey Avatar answered Oct 03 '22 19:10

Alexey