I usually create video clips of still images using something very similar to This StackOverflow example. However, this time, I have a set of images of varying sizes, so clipped in options from This OTHER StackOverflow example to pad the images to a set size to come up with this:

ffmpeg -r 1 -i slide_%2d.png  -filter_complex "fps=25,format=yuv420p,scale=1024:768:force_original_aspect_ratio=decrease,pad=1024:768:x=(1024-iw)/2:y=(768-ih)/2:color=green" -y tmp.mp4

Of course it doesn't work as hoped, but this is the 21st Century, 'Google It' way!

What I'm attempting to do is create a command which feeds contiguously-numbered png images (starting at 01), in the current directory, at the rate of one per second, and outputs them as an mp4 file, suitably padded to a 16:9 ratio image size, with an eye-bleeding green background/surround (it's a test rig – I want to see what's what, quickly) at an arbitrary rate of 25 frames per second on the output (all 25 frames to be of the same input input image, of course).

What I get is the last frame of the image set for a duration that varies, depending on the contents of the -r flag.

Could somebody help me out here, please, and show me where I'm going wrong? I can spend delighted hours searching and tinkering, but I should be wasting my time on other fascinating projects now.

All the best, QuinB

ffmpeg v. N-92396-g55e021f39b

OS Win10

  • Works here. Share full log. – Gyan Dec 3 '18 at 20:24
  • Here y'go. tmplog_20181203a.txt Thanks for taking a look. – Quin Benson Dec 3 '18 at 21:20
  • Cutting back the command to: ffmpeg -framerate 1 -i "test_%2d.png" "out03.mp4" produces output showing multiple images viewable in ffplay (although, obviously, not scaled as required) Adding in fps produces a short clip with a single image. ffmpeg -framerate 1 -i "test_%2d.png" -filter_complex "fps=25" "out06.mp4" omitting fps but scaling and formatting produces output showing multiple images ffmpeg -framerate 1 -i "test_%2d.png" -filter_complex "format=yuv420p,scale=1024:768" "out07.mp4" Adding in force_original_aspect_ratio=decrease gives 1 image – Quin Benson Dec 4 '18 at 9:23
  • however, adding in the pad sequence creates an output showing multiple images. ffmpeg -framerate 1 -i "test_%2d.png" -filter_complex "format=yuv420p,scale=1024:768:force_original_aspect_ratio=decrease,pad=1024:768:x=(1024-iw)/2:y=(768-ih)/2:color=green" "out10.mp4" "Eh, what?" – Quin Benson Dec 4 '18 at 9:47
  • ffmpeg -framerate 1 -i "test_%2d.png" -framerate 25 -filter_complex "format=yuv420p,scale=1024:768:force_original_aspect_ratio=decrease,pad=1024:768:x=(1024-iw)/2:y=(768-ih)/2:color=green" "out15.mp4" This produces output, as required, at 25fps who knows why. – Quin Benson Dec 4 '18 at 9:57

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.