3

How can I create a mpg/mp4 file from let's say 10 images using ffmpeg.

Each image shall stay for 5 minutes, after the 5 minutes are over the next image shall appear and so on....

How can I achieve this?

1 Answer 1

7

If your images are numbered in a sequence (img001, img002, img003..), use

ffmpeg -framerate 1/300 -i img%3d.jpg -r 5 video.mp4

(I've set an output framerate of 5 for player compatibility. Each image will still remain for 300 seconds)

If your filenames are irregular, and you are executing in a Unix shell like bash, you can run

ffmpeg -framerate 1/300 -pattern_type glob -i '*.jpg' -r 5 video.mp4

For MPEG-2,

ffmpeg -framerate 1/300 -i img%3d.jpg -c:v mpeg2video -b:v 2000k -r 5 video.mpg

No idea what minimum output framerates are expected of MPEG-2. Experiment.

13
  • Thank, I will try this out, a question what do you mean with *nix shell
    – utdev
    Aug 11, 2016 at 14:05
  • A question how would you do this if one needs an mpeg2 just name .mp4 to mpg ?
    – utdev
    Aug 11, 2016 at 14:10
  • Ok I got one last question how do I change the resolution of the created video here
    – utdev
    Aug 11, 2016 at 14:15
  • Add -s 1280x720 for 720p..etc
    – Gyan
    Aug 11, 2016 at 14:17
  • 1
    Hi again I checked this again and the 5minutes thing does not work
    – utdev
    Aug 12, 2016 at 9:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.