Convert BMP to video in a given frame rate in FFmpeg

2

I am trying to encode several BMPs\JPEG into a movie file using:

ffmpeg -f image2 -i a%d.jpg output.mpg      

The thing is that I want the frame rate of the movie to be 10, and it seems to be 25 (as a default I guess). How can I tell it what framerate to use?

I am using Windows 7, 64-bit (DELL).

user552231

Posted 2012-10-14T08:56:28.360

Reputation: 143

Answers

2

Please read the FFmpeg documentation. The framerate is specified with -r.

As an example for image-to-video conversion, they mention:

Use ffmpeg for creating a video from the images in the file sequence ‘img-001.jpeg’, ‘img-002.jpeg’, ..., assuming an input frame rate of 10 frames per second:

ffmpeg -i 'img-%03d.jpeg' -r 10 out.mkv

Note that normally, the usage of -f image2 isn't necessary. Also, the default settings used to convert to .mpg files may result in low quality. If you can afford it, try using x264 and MP4 container instead:

ffmpeg -i a%d.jpg -r 10 -c:v libx264 -preset slow -crf 21 output.mp4

Vary the -crf parameter for quality, where less means better quality and more means worse quality. Sane values could be anything from 18 to 26, with the default set at 23.

slhck

Posted 2012-10-14T08:56:28.360

Reputation: 182 472

Perhaps the documentation should be made more clear since by default images will have an input frame rate of 25. Adding -r 10 as an output option will cause ffmpeg to drop frames, but using it as an input option will use all frames. – llogan – 2012-10-14T18:06:56.560

Ah, interesting. So probably better specifying -r 10 -i … then for the above use case? – slhck – 2012-10-14T18:21:51.663

For the OP's use case I think it would probably be best as an input option. Unfortunately, I doubt .mpg can support 10 fps (yet another reason for your MP4 recommendation). Different -r values can be used for input and output, but that will lead to dupes or drops which may be hardly noticeable or really ugly. – llogan – 2012-10-14T19:37:00.977