Producing stable video from slow images with FFmpeg

Solution 1:

I'm not sure why the players won't work with 1 fps, but you can use -framerate for your input, and -r for your output to set different frame rates:

Example

ffmpeg -framerate 1 -i %02d.png -r 25 -pix_fmt yuv420p video.mp4

Notes

  • Image inputs use -framerate to set frame rate, while video output uses -r.

  • -f image2 is usually not required since the demuxer will recognize your inputs as images.

  • In this example ffmpeg will duplicate frames to reach the higher output frame rate, but it will still show the same "image" for each second.

  • Some encoders and containers may be limited in the frame rates that they support, but they will often let you know in the ffmpeg console output.

  • By default ffmpeg will use libx264 (H.264 video) as the encoder for MP4 container output. If it is unavailable then mpeg4 (MPEG-4 Part 2 video) will be used.

  • -pix_fmt yuv420p will output a widely compatible chroma subsampled output.

Just out of curiosity it might be interesting to find out the lowest output -framerate value that works in all of your players.

Also see

  • How do I encode single pictures into movies?
  • FFmpeg Wiki: H.264 Video Encoding Guide
  • FFmpeg Wiki: Create a video slideshow from images
  • FFmpeg image file demuxer documentation