Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adjust framerate MPG4 in ffMpeg

Tags:

ffmpeg

I'm trying to create a MPG4 movie from a bunch of png's. I want the movie to show one of the PNG-pictures every 1/5th second. So I tried the following command:

ffmpeg -i ffmpeg_temp/%05d.png -r 5 video.mp4

Now I get a movie of only 40 seconds, in which lot's of frames completely disappear.

I have around a 1000 pictures and want that to be a movie of around 3 minutes (5 fps).

like image 769
Gilles Avatar asked Aug 24 '11 15:08

Gilles


People also ask

How do I change frame rate in ffmpeg?

There are two ways to change the output frame rate: With the -r option used as an output option. With the ​fps filter.

How do I change mp4 frame rate?

Click the Video tab for options to change the video output. Use the "Framerate (FPS)" drop-down menu to select a new frame rate.

How do I reduce the bitrate of a video in ffmpeg?

Download and set up FFmpeg on your computer, use command line to compress video with FFmpeg by changing video codec format, lowering down bitrate, cutting video length, etc. For example, set CRF in FFmpeg to reduce video file size (ffmpeg -i input. mp4 -vcodec libx264 -crf 24 output.


1 Answers

You need to put the -r 5 before the -i ffmpeg_temp/%05d.png since options apply to the following file. In other words, the input is being read at the default 25fps and the output file has a frame rate of 5fps.

From the FFmpeg documentation:

As a general rule, options are applied to the next specified file. Therefore, order is important, and you can have the same option on the command line multiple times. Each occurrence is then applied to the next input or output file.

like image 74
TheJuice Avatar answered Oct 12 '22 01:10

TheJuice